private async Task Save()
        {
            if (!App.isBusy)
            {
                // ObservableCollection<FranchiseSellDetails_Class> fscd = new ObservableCollection<FranchiseSellDetails_Class>();
                App.isBusy = true;
                FranchiseSell_Class Franchise_Sell_Class = new FranchiseSell_Class();
                Franchise_Sell_Class.Customer_Id = Franchise_Sell_Class_Data.Customer_Id;

                var Wait = UserDialogs.Instance.Loading("Wait..", null, null, true, MaskType.Black);
                Wait.Show();

                if (Franchise_Sell_Class.Customer_Id > 0)
                {
                    Franchise_Sell_Class.Customer_Class_Data = Franchise_Sell_Class_Data.Customer_Class_Data;
                    foreach (var item in ArticleMasterClassList)
                    {
                        foreach (var Subitem in item.FranchiseStokeMaster_Class_List)
                        {
                            if (Subitem.Insert_New_Qty > 0)
                            {
                                FranchiseSellDetails_Class fsl = new FranchiseSellDetails_Class();
                                Franchise_Sell_Class.Total_Amount = Franchise_Sell_Class.Total_Amount + (Subitem.Insert_New_Qty * item.MRP);
                                fsl.SubCategory_Id = Subitem.SubCategoryMaster_Class_Data.SubCategory_Id;
                                fsl.Article_Id     = item.Article_Id;
                                fsl.MRP            = item.MRP;
                                fsl.Quantity       = Subitem.Insert_New_Qty;
                                StockMaster_Class smc = new StockMaster_Class();
                                smc.Stock_Id = Subitem.Stock_Id;
                                fsl.FranchiseStokeMaster_Class_Data = smc;
                                ArticleMaster_Class amc = new ArticleMaster_Class();
                                amc.Article_No               = item.Article_No;
                                amc.Article_PrimaryImage     = item.Article_PrimaryImage;
                                amc.Article_SecondaryImage   = item.Article_SecondaryImage;
                                fsl.ArticleMaster_Class_Data = amc;
                                CategoryMaster_Class cmc = new CategoryMaster_Class();
                                cmc.Category_Name = item.CategoryMaster_Class_Data.Category_Name + " - " + Subitem.SubCategoryMaster_Class_Data.SubCategory_Name;
                                fsl._CategoryMaster_Class_Data = cmc;
                                //fsl._SubCategoryMaster_Class_Data.SubCategory_Name = Subitem.SubCategory_Name;
                                fsl.Total_Amount = (fsl.MRP * fsl.Quantity).ToString();
                                // fscd.Add(fsl);
                                Franchise_Sell_Class.FranchiseSellDetails_Class_List.Add(fsl);
                            }
                        }
                    }
                    //   Franchise_Sell_Class_Data.FranchiseSellDetails_Class_List.Add(fscd);
                    Wait.Hide();
                    App.isBusy = false;
                    if (Franchise_Sell_Class.Total_Amount > 0)
                    {
                        await navigation.PushAsync(new SellDetailPage(Franchise_Sell_Class), true);
                    }
                    else
                    {
                        await App.Current.MainPage.DisplayAlert("Oops!", "Please Fill Qty Then Submit..", "Ok");
                    }
                }
                else
                {
                    if (Customer_Class.Customer_Name != null && Customer_Class.Customer_Name != "")
                    {
                        JObject result = await _IAllDataServices.CustomerRegistration(Customer_Class);

                        if (result != null && result["Type"].ToString() == "1" || result["Type"].ToString() == "0")
                        {
                            JObject result2 = await _IAllDataServices.GetCustomerByMobileNo(Customer_Class);

                            type1 = result2["Type"].ToString();
                            if (type1 == "1")
                            {
                                Franchise_Sell_Class.Customer_Id = (int)result2["Result"]["Customer_Id"];

                                foreach (var item in ArticleMasterClassList)
                                {
                                    foreach (var Subitem in item.FranchiseStokeMaster_Class_List)
                                    {
                                        if (Subitem.Insert_New_Qty > 0)
                                        {
                                            FranchiseSellDetails_Class fsl = new FranchiseSellDetails_Class();
                                            Franchise_Sell_Class.Total_Amount = Franchise_Sell_Class.Total_Amount + (Subitem.Insert_New_Qty * item.MRP);
                                            fsl.SubCategory_Id = Subitem.SubCategoryMaster_Class_Data.SubCategory_Id;
                                            fsl.Article_Id     = item.Article_Id;
                                            fsl.MRP            = item.MRP;
                                            fsl.Quantity       = Subitem.Insert_New_Qty;
                                            StockMaster_Class smc = new StockMaster_Class();
                                            smc.Stock_Id = Subitem.Stock_Id;
                                            fsl.FranchiseStokeMaster_Class_Data = smc;
                                            ArticleMaster_Class amc = new ArticleMaster_Class();
                                            amc.Article_No               = item.Article_No;
                                            amc.Article_PrimaryImage     = item.Article_PrimaryImage;
                                            amc.Article_SecondaryImage   = item.Article_SecondaryImage;
                                            fsl.ArticleMaster_Class_Data = amc;
                                            CategoryMaster_Class cmc = new CategoryMaster_Class();
                                            cmc.Category_Name = item.CategoryMaster_Class_Data.Category_Name + " - " + Subitem.SubCategoryMaster_Class_Data.SubCategory_Name;
                                            fsl._CategoryMaster_Class_Data = cmc;
                                            //fsl._SubCategoryMaster_Class_Data.SubCategory_Name = Subitem.SubCategory_Name;
                                            fsl.Total_Amount = (fsl.MRP * fsl.Quantity).ToString();
                                            // fscd.Add(fsl);
                                            Franchise_Sell_Class.FranchiseSellDetails_Class_List.Add(fsl);
                                        }
                                    }
                                }



                                if (Franchise_Sell_Class.Total_Amount > 0)
                                {
                                    App.isBusy = false;
                                    await navigation.PushAsync(new SellDetailPage(Franchise_Sell_Class), true);
                                }
                                else
                                {
                                    App.isBusy = false;
                                    await App.Current.MainPage.DisplayAlert("Oops!", "Please Fill Qty Then Submit..", "Ok");
                                }
                            }
                            else
                            {
                                App.isBusy = false;
                                await App.Current.MainPage.DisplayAlert("Oops!", "Something is worng please try Again....", "Ok");
                            }
                        }
                        else
                        {
                            App.isBusy = false;
                            await App.Current.MainPage.DisplayAlert("Oops!", (string)result["ResponseMessage"], "Ok");
                        }
                    }
                    else
                    {
                        App.isBusy = false;
                        await App.Current.MainPage.DisplayAlert("Oops!", "Please fill customer name ", "Ok");
                    }
                    Wait.Hide();
                }

                Wait.Hide();
            }
        }