private void AddOrUpdateItems(ECommerceDomain.Inventory.Inventory.Inventory inventory)
        {
            var itemsDTOs = GetAllInventoryItemDTOs();

            foreach (var item in inventory.Items)
            {
                if (itemsDTOs.Any(i => i.Product.SKU == item.SKU))
                {
                    //update
                    var itemDTO = itemsDTOs.First(i => i.Product.SKU == item.SKU);
                    itemDTO.Description = item.Description;
                    itemDTO.Category    = item.Category;
                    itemDTO.UnitCost    = item.UnitCost;

                    AddNewEntries(item);
                }
                else
                {
                    var product = _eCommerceContext.Products.Include(p => p.ProductCategory).First(i => i.SKU == item.SKU);
                    //add
                    var storedDTO = new InventoryItemDTO
                    {
                        Id          = product.Id,
                        Description = item.Description,
                        Category    = product.ProductCategory.Name,
                        Entries     = new List <InventoryItemEntryDTO>(),
                        UnitCost    = item.UnitCost
                    };

                    _eCommerceContext.InventoryItems.Add(storedDTO);
                }
            }
        }
        private IEnumerable <InventoryItemEntry> GetInventoryItemEntriesToAdd(InventoryItem item, InventoryItemDTO itemDTO)
        {
            var dtoEntryCount = itemDTO.Entries.Count;

            return(item.Entries.Skip(dtoEntryCount));
        }