Trig substitution fails for evaluating $ \int \frac{\cos x \sin x}{\sin^2{x} + \sin x + 1} dx$? Evaluate the integral 
\begin{equation}
\int \frac{\cos x \sin x}{\sin^2{x} + \sin x + 1} dx
\end{equation}
Basically I could substitute: $t = \sin x$ and get:
$$\int \frac{t}{t^2 +t + 1} dt$$
But, although it seems a reasonable integral to solve, it doesn't. 
So I tried to utilize some trigonometric identities but it didn't work out so well.
I'd be glad for help. 
 A: $$\int \frac{t}{t^2 +t + 1} dt = \int \frac{t}{\left(t+\frac 12\right)^2 + \frac 34}\,dt$$
$$\frac 34 = \left(\frac{\sqrt 3}2\right)^2$$
So , in therms of substitution, $$t+\frac 12 = \frac {\sqrt 3}2 \tan\theta\implies dt = \frac {\sqrt 3}2 \sec^2\theta\,d\theta,\quad \text{and}\;t = \frac{\sqrt 3}2\tan\theta - \frac 12$$
We can also express $\theta$ as a function of $t$: $$\tan\theta = \frac 2{\sqrt 3}\left(t+\frac 12\right) \implies \theta = \arctan\left(\frac 2{\sqrt 3}\left(t+\frac 12\right)\right)$$

$$
\begin{align}\int \frac{t}{\left(t+\frac 12\right)^2 + \frac 34}\,dt &= \int \frac{\left(\frac{\sqrt 3}2\tan\theta - \frac 12\right)\cdot \frac{\sqrt 3}2 \sec^2\theta}{\frac 34(\tan^2 \theta + 1)}\\ \\
& =\int \frac{\left(\frac 34\right)\tan\theta\sec^2\theta - \frac{\sqrt 3}4\sec^2\theta\,d\theta}{\frac 34(\tan^2\theta + 1)}\\ \\
&= \int \frac{\tan\theta\sec^2\theta}{\sec^2 \theta}\,d\theta -\frac 1{\sqrt 3}\int \frac{\sec^2\theta\,d\theta}{\sec^2 \theta} \\ \\ 
&= \int \frac {\sin\theta}{\cos\theta}\,d\theta - \frac 1{\sqrt 3}\int \,d\theta
\end{align}$$
Now all that remains is readily evaluating the integrals, then back-substituting in terms of $t$, then again for the substitution $t = \sin\theta$.
A: As $\dfrac{d(t^2+t+1)}{dt}=2t+1$
$$2I=\int\frac{2t}{t^2+t+1}dt=\int\frac{2t+1}{t^2+t+1}dt-\int\frac1{\left(t+1/2\right)^2+(\sqrt3/2)^2}dt$$
Now,
$$\int\frac{2t+1}{t^2+t+1}dt=\ln|t^2+t+1|+C$$
and set $t+a=b\tan\theta$  to find $$\int\frac{dt}{\left(t+a\right)^2+b^2}=\frac1{2a}\arctan\dfrac{t+a}b+K$$
