/// <summary>
        /// Insert a new ProductAttributeConfigItem 
        /// </summary>
        /// <param name="item"></param>
        public void Insert(ProductAttributeConfigItem item)
        {
            item.CreatedUtc = DateTime.UtcNow;
            item.UpdatedUtc = DateTime.UtcNow;

            _repository.Insert(item);
            _eventPublisher.EntityInserted<ProductAttributeConfigItem>(item);
        }
        private static List<ProductImportRequestAttributeItem> GetValueForConfigItem(ProductAttributeConfigItem item, Product product, List<Vendor> vendors, List<TaxCategory> taxCategories, ICategoryService categoryService)
        {
            var returnItems = new List<ProductImportRequestAttributeItem>();
            switch (item.SystemName.ToLower())
            {
                case ProductAttributeConfigSystemNames.AVAILABLE_FOR_PREORDER:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.AvailableForPreOrder.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.CALL_FOR_PRICE:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.CallForPrice.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.CATEGORY:
                    product.ProductCategories.ToList()
                                             .ForEach(pc =>
                                             {
                                                 returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = pc.Category.Name });
                                             });
                    break;

                case ProductAttributeConfigSystemNames.CATEGORY_BREADCRUMBS:
                    product.ProductCategories.ToList()
                                             .ForEach(pc =>
                                             {
                                                 var breadCrumb = pc.Category.GetFormattedBreadCrumb(categoryService);
                                                 returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = breadCrumb });
                                             });
                    break;
                case ProductAttributeConfigSystemNames.MANUFACTURER:
                    product.ProductManufacturers.ToList()
                                                .ForEach(pm =>
                                                {
                                                    if (pm.Manufacturer != null)
                                                        returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = pm.Manufacturer.Name });
                                                });
                    break;

                case ProductAttributeConfigSystemNames.CUSTOMER_ENTERS_PRICE:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.CustomerEntersPrice.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.DISABLE_BUY_BUTTON:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.DisableBuyButton.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.DOWNLOADABLE_PRODUCT:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.IsDownload.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.FREE_SHIPPING:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.IsFreeShipping.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.GIFT_CARD_TYPE:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.IsGiftCard ? product.GiftCardType.ToString() : string.Empty });
                    break;

                case ProductAttributeConfigSystemNames.GTIN:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.Gtin });
                    break;

                case ProductAttributeConfigSystemNames.IS_GIFT_CARD:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.IsGiftCard.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.IS_RENTAL:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.IsRental.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.MANUFACTURER_PART_NO:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.ManufacturerPartNumber });
                    break;

                case ProductAttributeConfigSystemNames.PRODUCT_SPECIFICATION_ATTRIBS:
                    product.ProductSpecificationAttributes.ToList()
                                                          .ForEach(pcs =>
                                                              {
                                                                  returnItems.Add(new ProductImportRequestAttributeItem()
                                                                      {
                                                                          Name = pcs.SpecificationAttributeOption.SpecificationAttribute.Name,
                                                                          Value = !string.IsNullOrEmpty(pcs.CustomValue) ? pcs.CustomValue : pcs.SpecificationAttributeOption.Name
                                                                      });                                                                  
                                                              });
                    break;

                case ProductAttributeConfigSystemNames.SHIP_SEPARATELY:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.ShipSeparately.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.SHIPPING_ENABLED:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.IsShipEnabled.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.SKU:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.Sku });
                    break;

                case ProductAttributeConfigSystemNames.TAX_CATEGORY:
                    var taxCategory = taxCategories.Where(tc => tc.Id == product.TaxCategoryId).FirstOrDefault();
                    if (taxCategory != null)
                        returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = taxCategory.Name });
                    break;

                case ProductAttributeConfigSystemNames.TAX_EXCEMPT:
                    returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = product.IsTaxExempt.ToString() });
                    break;

                case ProductAttributeConfigSystemNames.VENDOR:
                    var vendor = vendors.Where(v => v.Id == product.VendorId).FirstOrDefault();
                    if (vendor != null)
                        returnItems.Add(new ProductImportRequestAttributeItem() { Name = item.SystemName, Value = vendor.Name });
                    break;

                default:
                    break;
            }

            return returnItems;
        }
 /// <summary>
 /// Update an existing ProductAttributeConfigItem
 /// </summary>
 /// <param name="item"></param>
 public void Update(ProductAttributeConfigItem item)
 {
     item.UpdatedUtc = DateTime.UtcNow;
     _repository.Update(item);
     _eventPublisher.EntityUpdated<ProductAttributeConfigItem>(item);
 }