The collective ordering of magnetic nanoparticles in a nematic liquid crystal