// assumes that parameters are consistent with the datatype configuration
        // value can be an enumeration of string, or a serialized value using storageType format
        private static void SetTagsValue(Property property, object value, TagsStorageType storageType, char delimiter, string culture)
        {
            if (value == null)
            {
                value = Enumerable.Empty <string>();
            }

            // if value is already an enumeration of strings, just use it
            if (value is IEnumerable <string> tags1)
            {
                property.AssignTags(tags1, false, storageType, delimiter, culture);
                return;
            }

            // otherwise, deserialize value based upon storage type
            switch (storageType)
            {
            case TagsStorageType.Csv:
                var tags2 = value.ToString().Split(new[] { delimiter }, StringSplitOptions.RemoveEmptyEntries);
                property.AssignTags(tags2, false, storageType, delimiter, culture);
                break;

            case TagsStorageType.Json:
                try
                {
                    var tags3 = JsonConvert.DeserializeObject <IEnumerable <string> >(value.ToString());
                    property.AssignTags(tags3 ?? Enumerable.Empty <string>(), false, storageType, delimiter, culture);
                }
                catch (Exception ex)
                {
                    Current.Logger.Warn(typeof(PropertyTagsExtensions), ex, "Could not automatically convert stored json value to an enumerable string '{Json}'", value.ToString());
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(storageType));
            }
        }
        /// <summary>
        /// Assign tags.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="tags">The tags.</param>
        /// <param name="merge">A value indicating whether to merge the tags with existing tags instead of replacing them.</param>
        /// <param name="culture">A culture, for multi-lingual properties.</param>
        public static void AssignTags(this Property property, IEnumerable <string> tags, bool merge = false, string culture = null)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            var configuration = property.GetTagConfiguration();

            if (configuration == null)
            {
                throw new NotSupportedException($"Property with alias \"{property.Alias}\" does not support tags.");
            }

            property.AssignTags(tags, merge, configuration.StorageType, configuration.Delimiter, culture);
        }