Add serialization and deserialization logic