move serializePolymorphicType to RESTSerializer