Add serializePolymorphicType hook and move it from
the JSONSerializer to the RESTSerializer
Document serializeIntoHash method