Effect of the swelling degree on the formation of magnetite nanoparticles in hydrogels