private void SerializeRelationships(IEnumerable <IModelRelationship> relationships, HashSet <Identity> deletedElements) { _writer.NewScope("relationships"); foreach (var relationship in relationships) { if (deletedElements != null && deletedElements.Remove(relationship.Id)) { _writer.PushDeletedElement("relationship", GetId(relationship.Id)); continue; } _writer.PushElement("relationship", GetId(relationship.Id), GetSchemaMoniker(relationship), GetId(relationship.Start.Id), GetSchemaMoniker(relationship.Start), GetId(relationship.End.Id), GetSchemaMoniker(relationship.End)); SerializeProperties(relationship); } if (deletedElements != null) { foreach (var id in deletedElements) { _writer.PushDeletedElement("relationship", GetId(id)); } } _writer.ReduceScope(); }