public static RestContentItem ToRest(this ContentEmbedded contentItem) { RestContentItem restContentItem = new RestContentItem(); restContentItem.Schema = JObject.FromObject(contentItem.Schema.ToRest()); foreach (var field in contentItem.Fields) { restContentItem.Fields.Add(field.Key, field.Value.ToRestValue()); } return(restContentItem); }
public static ContentEmbedded ToModel(this RestContentEmbedded restContentItem) { ContentSchema schema = restContentItem.Schema.ToModel(); ContentEmbedded contentItem = schema.CreateContentEmbedded(); foreach (var restField in restContentItem.Fields) { restField.Value.FromRestValue(restField.Key, contentItem, schema); } return(contentItem); }