Generated regressor and interaction term

I want to estimate the following model

$y_{it} = \gamma_{0} + \gamma_{1} x_{it} + \gamma_{2} \theta_{i} x_{it} + u_{it}$

where the $\theta_i$ is unknown but I can estimate it in another regression. Plugging in that estimate and rewriting the equation, I get

$y_{it} = \gamma_{0} + \gamma_{1} x_{it} + \gamma_{2} \hat \theta_{i} x_{it} + u_{it} + \gamma_{2} x_{it} (\theta_i - \hat \theta_{i})$

The last two terms are obviously unobserved, and the last one correlates with $x_{it}$, so my estimates are inconsistent. I am hoping that this is a common problem that has some established fix. Does anyone know literature on that?

I think I was too quick in seeing a problem here; if the first stage is consistent, so is the second stage since $\hat \theta \to_p \theta$, even though it will be biased in finite samples. So I guess this problem is solved.
The easiest way to correct for this problem is to bootstrap. Assuming you are using the same dataset for estimating $\hat{\theta}$ as for the regression of interest, you want to estimate $\hat{\theta}$ with the bootstrapped sample, this introduces variation between samples which converges to the true variation as the number of replications approaches infinity.