protected async override void DeleteSelected()
        {
            if (
                MessageBox.Show("Are you sure you want to delete this commodity supplier?",
                                     "Agrimanagr: Delete Commodity Supplier", MessageBoxButton.YesNo) ==
                     MessageBoxResult.No) return;

            using (var c = NestedContainer)
            {
                if (SelectedCommoditySupplier.Status==EntityStatus.Active)
                {

                    var commoditySupplier =Using<ICommoditySupplierRepository>(c).GetById(SelectedCommoditySupplier.SupplierId) as CommoditySupplier; 
                   
                    if (Using<IMasterDataUsage>(c).CommoditySupplierHasOwnersOrProducers(commoditySupplier))// 1SelectedCommodityOwner.CommoditySupplier))
                    {
                        MessageBox.Show(
                            "Commodity Supplier " + SelectedCommoditySupplier.Name +
                            " has purchases in the system and thus cannot be deleted.",
                            "Agrimanagr: Delete Commodity Supplier", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    }
                }
                ResponseBool response = new ResponseBool() { Success = false };
                // 1 if (SelectedCommodityOwner == null) return;
                if (SelectedCommoditySupplier == null) return;
                _proxy = Using<IDistributorServiceProxy>(c);
                response = await _proxy.CommoditySupplierDeleteAsync(SelectedCommoditySupplier.SupplierId);
                if (response.Success)
                {
                    var commoditysupplier = Using<ICommoditySupplierRepository>(c).GetById(SelectedCommoditySupplier.SupplierId);
                    Using<ICommoditySupplierRepository>(c).SetAsDeleted(commoditysupplier);

                    MessageBox.Show(response.ErrorInfo, "Agrimangr:Manage Commodity Supplier", MessageBoxButton.OK,
                                   MessageBoxImage.Information);
                    Load();
                }
                   
            }
        }