Refactor to decouple controller mixin from AM::Serializer

Since `AM::Serializer.build_json` is highly dependent on the controller it should be a helper function of the controller. Functionality hasn't changed.

Eventually it would be great to unify the usage of the root attribute for arrays and single objects to get rid of the awkward lines 61-65.