public static DynamicProperty ToDynamicProperty(this coreDto.DynamicObjectProperty propertyDto)
        {
            var result = new DynamicProperty();

            result.InjectFrom<NullableAndEnumValueInjecter>(propertyDto);

            if (propertyDto.DisplayNames != null)
            {
                result.DisplayNames = propertyDto.DisplayNames.Select(x => new LocalizedString(new Language(x.Locale), x.Name)).ToList();
            }

            if (propertyDto.Values != null)
            {
                if (result.IsDictionary)
                {
                    var dictValues = propertyDto.Values
                        .Where(x => x.Value != null)
                        .Select(x => x.Value)
                        .Cast<JObject>()
                        .Select(x => x.ToObject<platformDto.DynamicPropertyDictionaryItem>())
                        .ToArray();

                    result.DictionaryValues = dictValues.Select(x => x.ToDictItem()).ToList();
                }
                else
                {
                    result.Values = propertyDto.Values
                        .Where(x => x.Value != null)
                        .Select(x => x.ToLocalizedString())
                        .ToList();
                }
            }

            return result;
        }
        public static coreDto.DynamicObjectProperty ToDynamicPropertyDto(this DynamicProperty dynamicProperty)
        {
            var result = new coreDto.DynamicObjectProperty();

            result.InjectFrom<NullableAndEnumValueInjecter>(dynamicProperty);

            if (dynamicProperty.Values != null)
            {
                result.Values = dynamicProperty.Values.Select(v => v.ToPropertyValueDto()).ToList();
            }
            else if (dynamicProperty.DictionaryValues != null)
            {
                result.Values = dynamicProperty.DictionaryValues.Select(x => x.ToPropertyValueDto()).ToList();
            }

            return result;
        }
        public static DynamicProperty ToDynamicProperty(this coreDto.DynamicObjectProperty propertyDto)
        {
            var result = new DynamicProperty();

            result.Id           = propertyDto.Id;
            result.IsArray      = propertyDto.IsArray ?? false;
            result.IsDictionary = propertyDto.IsDictionary ?? false;
            result.IsRequired   = propertyDto.IsRequired ?? false;
            result.Name         = propertyDto.Name;
            result.ValueType    = propertyDto.ValueType;

            if (propertyDto.DisplayNames != null)
            {
                result.DisplayNames = propertyDto.DisplayNames.Select(x => new LocalizedString(new Language(x.Locale), x.Name)).ToList();
            }

            if (propertyDto.Values != null)
            {
                if (result.IsDictionary)
                {
                    var dictValues = propertyDto.Values
                                     .Where(x => x.Value != null)
                                     .Select(x => x.Value)
                                     .Cast <JObject>()
                                     .Select(x => x.ToObject <platformDto.DynamicPropertyDictionaryItem>())
                                     .ToArray();

                    result.DictionaryValues = dictValues.Select(x => x.ToDictItem()).ToList();
                }
                else
                {
                    result.Values = propertyDto.Values
                                    .Where(x => x.Value != null)
                                    .Select(x => x.ToLocalizedString())
                                    .ToList();
                }
            }

            return(result);
        }
        public static coreDto.DynamicObjectProperty ToDynamicPropertyDto(this DynamicProperty dynamicProperty)
        {
            var result = new coreDto.DynamicObjectProperty();

            result.Id           = dynamicProperty.Id;
            result.IsArray      = dynamicProperty.IsArray;
            result.IsDictionary = dynamicProperty.IsDictionary;
            result.IsRequired   = dynamicProperty.IsRequired;
            result.Name         = dynamicProperty.Name;
            result.ValueType    = dynamicProperty.ValueType;

            if (dynamicProperty.Values != null)
            {
                result.Values = dynamicProperty.Values.Select(v => v.ToPropertyValueDto()).ToList();
            }
            else if (dynamicProperty.DictionaryValues != null)
            {
                result.Values = dynamicProperty.DictionaryValues.Select(x => x.ToPropertyValueDto()).ToList();
            }

            return(result);
        }