Add serialization support for generic types