Recursive serialization and deserialization implemented