public override void UpdateAsync(long id, GarmentSalesContract model)
        {
            if (model.Items != null)
            {
                HashSet <long> itemIds = GarmentSalesContractItemLogic.GetGSalesContractIds(id);
                if (itemIds.Count.Equals(0))
                {
                    foreach (var detail in model.Items)
                    {
                        GarmentSalesContractItemLogic.Create(detail);
                        //EntityExtension.FlagForCreate(detail, IdentityService.Username, "sales-service");
                    }
                }
                //else if (model.Items.Count.Equals(0))
                //{
                //    foreach (var oldItem in itemIds)
                //    {
                //        GarmentSalesContractItem dataItem = DbContext.GarmentSalesContractItems.FirstOrDefault(prop => prop.Id.Equals(oldItem));
                //        EntityExtension.FlagForDelete(dataItem, IdentityService.Username, "sales-service");
                //    }
                //}
                else
                {
                    foreach (var itemId in itemIds)
                    {
                        GarmentSalesContractItem data = model.Items.FirstOrDefault(prop => prop.Id.Equals(itemId));
                        if (data == null)
                        {
                            GarmentSalesContractItem dataItem = DbContext.GarmentSalesContractItems.FirstOrDefault(prop => prop.Id.Equals(itemId));
                            EntityExtension.FlagForDelete(dataItem, IdentityService.Username, "sales-service");
                        }
                        //await GarmentSalesContractItemLogic.DeleteAsync(itemId);
                        else
                        {
                            //GarmentSalesContractItem dataItem = DbContext.GarmentSalesContractItems.FirstOrDefault(prop => prop.Id.Equals(itemId));
                            //EntityExtension.FlagForUpdate(dataItem, IdentityService.Username, "sales-service");
                            GarmentSalesContractItemLogic.UpdateAsync(itemId, data);
                        }

                        foreach (GarmentSalesContractItem item in model.Items)
                        {
                            if (item.Id == 0)
                            {
                                GarmentSalesContractItemLogic.Create(item);
                            }
                        }
                    }
                }
            }

            EntityExtension.FlagForUpdate(model, IdentityService.Username, "sales-service");
            DbSet.Update(model);
        }
        public async Task DeleteAsync_Return_Success()
        {
            string           testName        = GetCurrentMethod();
            var              dbContext       = _dbContext(testName);
            IIdentityService identityService = new IdentityService {
                Username = "******"
            };
            var model = new GarmentSalesContractItem()
            {
                GarmentSalesContract = new GarmentSalesContract()
            };

            dbContext.GarmentSalesContractItems.Add(model);
            dbContext.SaveChanges();

            GarmentSalesContractItemLogic unitUnderTest = new GarmentSalesContractItemLogic(GetServiceProvider(testName).Object, identityService, dbContext);
            await unitUnderTest.DeleteAsync(model.Id);
        }