implement serialization of nested entities