Green synthesis of magnetic nanoparticles for wastewater treatment