By using the properties of definite integrals, evaluate $\int_0^{\pi}\frac{x}{1+\sin x}dx$.
My attempt:
(Using the property $\int_0^{2a}f(x)dx=\int_0^a(f(x)+f(2a-x))dx$)
$$\int_0^{2\frac{\pi}{2}}\frac{x}{1+\sin x}dx=\int_0^{\frac{\pi}{2}}(\frac{x}{1+\sin x}+\frac{\pi-x}{1+\sin x})dx$$$$=\pi\int_0^{\frac{\pi}{2}}\frac1{1+\sin x}dx=\pi\int_0^{\frac{\pi}{2}}\frac{1-\sin x}{\cos^2x}dx$$$$=\pi\int_0^{\frac{\pi}{2}}(\sec^2x-\sec x\tan x)dx=\pi[\tan x-\sec x]_0^{\frac{\pi}{2}}$$
Now I am stuck. I understand there might be other ways of solving it, but what's wrong in my method? Why am I not getting the answer?