private void Apply(ContentTypePartDefinition model, ContentTypePartRecord record) {
     record.Settings = Compose(_settingsFormatter.Map(model.Settings));
 }
 ContentTypePartDefinition Build(ContentTypePartRecord source) {
     return new ContentTypePartDefinition(
         Build(source.ContentPartRecord),
         _settingsFormatter.Map(Parse(source.Settings)));
 }
        private void Apply(ContentTypeDefinition model, ContentTypeRecord record) {
            record.DisplayName = model.DisplayName;
            record.Settings = _settingsFormatter.Map(model.Settings).ToString();

            var toRemove = record.ContentTypePartRecords
                .Where(partDefinitionRecord => model.Parts.All(part => partDefinitionRecord.ContentPartRecord.Name != part.PartDefinition.Name))
                .ToList();

            foreach (var remove in toRemove) {
                record.ContentTypePartRecords.Remove(remove);
            }

            foreach (var part in model.Parts) {
                var partName = part.PartDefinition.Name;
                var typePartRecord = record.ContentTypePartRecords.SingleOrDefault(r => r.ContentPartRecord.Name == partName);
                if (typePartRecord == null) {
                    typePartRecord = new ContentTypePartRecord { ContentPartRecord = Acquire(part.PartDefinition) };
                    record.ContentTypePartRecords.Add(typePartRecord);
                }
                Apply(part, typePartRecord);
            }
        }