key( "type" ).value( state.entityDescriptor().type().getName() ).
key( "version" ).value( identity ).
key( "modified" ).value( lastModified ).
key( "properties" ).object();
EntityDescriptor entityType = state.entityDescriptor();
JSONWriterSerializer serializer = new JSONWriterSerializer( json );
for( PropertyDescriptor persistentProperty : entityType.state().properties() )
{
Object value = state.properties().get( persistentProperty.qualifiedName() );
json.key( persistentProperty.qualifiedName().name() );
serializer.serialize( value, persistentProperty.valueType() );
}
JSONWriter associations = properties.endObject().key( "associations" ).object();
for( Map.Entry<QualifiedName, EntityReference> stateNameEntityReferenceEntry : state.associations()
.entrySet() )