/// <summary>
        /// The to product attribute.
        /// </summary>
        /// <param name="productAttributeDisplay">
        /// The product attribute display.
        /// </param>
        /// <param name="destinationProductAttribute">
        /// The destination product attribute.
        /// </param>
        /// <returns>
        /// The <see cref="IProductAttribute"/>.
        /// </returns>
        internal static IProductAttribute ToProductAttribute(this ProductAttributeDisplay productAttributeDisplay, IProductAttribute destinationProductAttribute)
        {
            if (productAttributeDisplay.Key != Guid.Empty)
            {
                destinationProductAttribute.Key = productAttributeDisplay.Key;
            }

            var validPropertyTypeAliases = productAttributeDisplay.DetachedDataValues.Select(x => x.Key);
            var removeAtts = destinationProductAttribute.DetachedDataValues.Where(x => validPropertyTypeAliases.All(y => y != x.Key));

            foreach (var remove in removeAtts)
            {
                destinationProductAttribute.DetachedDataValues.RemoveValue(remove.Key);
            }

            foreach (var item in productAttributeDisplay.DetachedDataValues)
            {
                if (!item.Key.IsNullOrWhiteSpace())
                {
                    destinationProductAttribute.DetachedDataValues.AddOrUpdate(item.Key, item.Value, (x, y) => item.Value);
                }
            }


            destinationProductAttribute.Name      = productAttributeDisplay.Name;
            destinationProductAttribute.Sku       = productAttributeDisplay.Sku;
            destinationProductAttribute.OptionKey = productAttributeDisplay.OptionKey;
            destinationProductAttribute.SortOrder = productAttributeDisplay.SortOrder;

            return(destinationProductAttribute);
        }
        internal static IProductAttribute ToProductAttribute(this ProductAttributeDisplay productAttributeDisplay, IProductAttribute destinationProductAttribute)
        {
            if (productAttributeDisplay.Key != Guid.Empty)
            {
                destinationProductAttribute.Key = productAttributeDisplay.Key;
            }
            destinationProductAttribute.Name      = productAttributeDisplay.Name;
            destinationProductAttribute.Sku       = productAttributeDisplay.Sku;
            destinationProductAttribute.OptionKey = productAttributeDisplay.OptionKey;
            destinationProductAttribute.SortOrder = productAttributeDisplay.SortOrder;

            return(destinationProductAttribute);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ProductAttributeContent"/> class.
        /// </summary>
        /// <param name="contentType">
        /// The content type.
        /// </param>
        /// <param name="display">
        /// The display.
        /// </param>
        /// <param name="parent">
        /// The parent content - generally set to the <see cref="IProductContent"/> containing the option
        /// </param>
        /// <param name="isPreviewing">
        /// The is previewing.
        /// </param>
        public ProductAttributeContent(
            PublishedContentType contentType,
            ProductAttributeDisplay display,
            IPublishedContent parent = null,
            bool isPreviewing = false)
        {
            Mandate.ParameterNotNull(display, "display");
            _contentType = contentType;
            _display = display;
            _parent = parent;
            _isForPreview = isPreviewing;

            this.Initialize();
        }