Synthesis and characterization of Mg doped TiO2 nanoparticles for photocatalytic applications