recursive serialization