Supporting polymorphic serialization.
Implemented and tested polymorphic serialization.