// ReSharper restore UnassignedField.Compiler

        public CartItemModel(VariationContent entry)
        {
            Code  = entry.Code;
            Name  = GetCleanString(entry.DisplayName);
            Entry = entry;
            var parent = entry.GetParent();
            var media  = entry.GetCommerceMedia();

            if (entry is FashionItemContent)
            {
                FashionItemContent fashionItemContent = (FashionItemContent)entry;
                Size = fashionItemContent.Facet_Size;
            }
            //TODO: Make this generic, move proerty to base?
            else if (entry.Property["Size"] != null)
            {
                Size = (string)entry.Property["Size"].Value;
            }


            if (media != null)
            {
                ImageUrl = _urlResolver.Service.GetUrl(media.AssetContentLink(_permanentLinkMapper.Service));
            }
            else if (parent != null)
            {
                //If variant does not have images, we get image from product
                media = parent.GetCommerceMedia();
                if (media != null)
                {
                    ImageUrl = _urlResolver.Service.GetUrl(media.AssetContentLink(_permanentLinkMapper.Service));
                }
            }

            if (parent != null)
            {
                ColorImageUrl = parent.AssetSwatchUrl();
                if (parent is FashionProductContent)
                {
                    var fashionProductContent = (FashionProductContent)parent;
                    Color         = fashionProductContent.FacetColor;
                    ArticleNumber = fashionProductContent.Code;
                    if (fashionProductContent.SizeAndFit != null &&
                        fashionProductContent.SizeAndFit.ToHtmlString() != null)
                    {
                        Description = fashionProductContent.SizeAndFit.ToHtmlString().StripHtml().StripPreviewText(255);
                    }
                    else
                    {
                        Description = "";
                    }
                }
            }
        }
        // ReSharper restore UnassignedField.Compiler
        public CartItemModel(VariationContent entry)
        {
            Code = entry.Code;
            Name = GetCleanString(entry.DisplayName);
            Entry = entry;
            var parent = entry.GetParent();
            var media = entry.GetCommerceMedia();
            if (entry is FashionItemContent)
            {
                FashionItemContent fashionItemContent = (FashionItemContent) entry;
                Size = fashionItemContent.Facet_Size;
            }
            //TODO: Make this generic, move proerty to base?
            else if(entry.Property["Size"] != null)
            {
                Size = (string)entry.Property["Size"].Value;
            }

            if (media != null)
            {
                ImageUrl = _urlResolver.Service.GetUrl(media.AssetContentLink(_permanentLinkMapper.Service));
            }
            else if (parent != null)
            {
                //If variant does not have images, we get image from product
                media = parent.GetCommerceMedia();
                if(media != null)
                    ImageUrl = _urlResolver.Service.GetUrl(media.AssetContentLink(_permanentLinkMapper.Service));
            }

            if (parent != null)
            {
                ColorImageUrl = parent.AssetSwatchUrl();
                if (parent is FashionProductContent)
                {
                    var fashionProductContent = (FashionProductContent)parent;
                    Color = fashionProductContent.FacetColor;
                    ArticleNumber = fashionProductContent.Code;
                    if (fashionProductContent.SizeAndFit != null &&
                        fashionProductContent.SizeAndFit.ToHtmlString() != null)
                    {
                        Description = fashionProductContent.SizeAndFit.ToHtmlString().StripHtml().StripPreviewText(255);
                    }
                    else
                    {
                        Description = "";
                    }
                }
            }
        }