public DeliveryOrderDetail UnconfirmObject(DeliveryOrderDetail deliveryOrderDetail, IDeliveryOrderService _deliveryOrderService,
                                            ISalesOrderService _salesOrderService, ISalesOrderDetailService _salesOrderDetailService,
                                            ISalesInvoiceDetailService _salesInvoiceDetailService, IStockMutationService _stockMutationService,
                                            IItemService _itemService, IBarringService _barringService, IWarehouseItemService _warehouseItemService)
 {
     if (_validator.ValidUnconfirmObject(deliveryOrderDetail, _salesInvoiceDetailService))
     {
         deliveryOrderDetail = _repository.UnconfirmObject(deliveryOrderDetail);
         DeliveryOrder         deliveryOrder  = _deliveryOrderService.GetObjectById(deliveryOrderDetail.DeliveryOrderId);
         WarehouseItem         warehouseItem  = _warehouseItemService.FindOrCreateObject(deliveryOrder.WarehouseId, deliveryOrderDetail.ItemId);
         Item                  item           = _itemService.GetObjectById(deliveryOrderDetail.ItemId);
         IList <StockMutation> stockMutations = _stockMutationService.SoftDeleteStockMutationForDeliveryOrder(deliveryOrderDetail, warehouseItem);
         foreach (var stockMutation in stockMutations)
         {
             //item.PendingDelivery += deliveryOrderDetail.Quantity;
             //item.Quantity += deliveryOrderDetail.Quantity;
             _stockMutationService.ReverseStockMutateObject(stockMutation, _itemService, _barringService, _warehouseItemService);
         }
         SalesOrderDetail salesOrderDetail = _salesOrderDetailService.GetObjectById(deliveryOrderDetail.SalesOrderDetailId);
         _salesOrderDetailService.UnsetDeliveryComplete(salesOrderDetail, deliveryOrderDetail.Quantity, _salesOrderService);
     }
     return(deliveryOrderDetail);
 }