Serialization framework for models