Fixed #23822 -- Added support for serializing model managers in migration

Thanks to Shai Berger, Loïc Bistuer, Simon Charette, Andrew Godwin, Tim
Graham, Carl Meyer and others for their comments, review, help and
input.