public static ContentSchemaField ToModel(this RestContentSchemaField definition)
        {
            Type optionsType = ContentFieldManager.Default.GetOptionsType(definition.FieldType);

            ContentFieldOptions options = (ContentFieldOptions)definition.Options.ToObject(optionsType, NewtonJsonExtensions.CreateSerializer());

            ContentSchemaField schemaField = new ContentSchemaField(definition.FieldType, options);

            schemaField.Label   = definition.Label;
            schemaField.SortKey = definition.SortKey;

            return(schemaField);
        }
        public static RestContentSchemaField ToRest(this ContentSchemaField schemaField)
        {
            RestContentSchemaField restContentFieldDefinition = new RestContentSchemaField();

            restContentFieldDefinition.Label     = schemaField.Label;
            restContentFieldDefinition.SortKey   = schemaField.SortKey;
            restContentFieldDefinition.FieldType = schemaField.FieldType;

            if (schemaField.Options != null)
            {
                restContentFieldDefinition.Options = JObject.FromObject(schemaField.Options, NewtonJsonExtensions.CreateSerializer());
            }

            return(restContentFieldDefinition);
        }