public static bool SaveSaleDetails(Sale sale, List<ItemSKU> skuList)
        {
            using (var session = NHibernateHelper.OpenSession())
            {
                using (var tx = session.BeginTransaction())
                {
                    try
                    {
                        sale.Items.ForEach(x => x.Sale = sale);

                        foreach (SaleItem saleitem in sale.Items)
                        {
                            int index = sale.Items.IndexOf(saleitem);

                            ItemSKU skuitem = skuList[index];
                            skuitem.StockQuantity -= saleitem.Quantity;
                            skuitem.Item.InReserve = (skuitem.Item.ReserveStock > skuitem.StockQuantity) ? true : false;

                            session.SaveOrUpdate(skuitem);
                        }
                        session.SaveOrUpdate(sale);
                        tx.Commit();
                    }
                    catch (Exception ex)
                    {
                        tx.Rollback();
                        log.Info("Purchase Order Failed.");
                        log.Error(ex);
                        return false;
                    }
                    return true;
                }
            }
        }
        protected override void SaveToolStrip_Click(object sender, EventArgs e)
        {
            #region _validation
            if (this.cust == null && this.memb == null)
            {
                MessageBox.Show("Adding Consumer details is Mandatory.", "Add Consumer", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            else if (this.saleItemList.Count == 0)
            {
                MessageBox.Show("Sale Item cart cannot be empty.", "Add Items to Cart", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            #endregion _validation

            UpdateStatus("Saving..", 25);

            decimal totalRebate = 0;
            foreach (var item in skuItemList)
            {
                int index = skuItemList.IndexOf(item);
                totalRebate += (item.ResalePrice - item.WholesalePrice) * saleItemList[index].Quantity;
            }

            /*Prepare Model*/
            Sale sale = new Sale(this.saleItemList, rdbCredit.Checked, AmountPaid, TotalAmount, dtpDateOfSale.Value.Date, totalRebate,this.cust, this.memb, TransportCharge, BalanceAmount);

            UpdateStatus("Saving..", 50);
            //deduct the total stock on save
            bool success = Savers.SaleDetailsSaver.SaveSaleDetails(sale, skuItemList);

            if (success)
            {
                UpdateStatus("Sale Saved.", 100);
                this.Close();
                return;
            }
        }