public override async Task SaveStock()
        {
            string[]    jsons  = File.ReadAllLines(FileManager.stocksFilePath);
            List <Item> stocks = new List <Item>();

            for (int i = 0; i < jsons.Length; i++)
            {
                stocks.Add(Newtonsoft.Json.JsonConvert.DeserializeObject <Item>(jsons[i]));
            }

            await DeleteStocks();

            await AddStocks(stocks);

            DateTime         date     = DateTime.Now;
            FirebaseDataTime dataTime = new FirebaseDataTime()
            {
                Year   = date.Year,
                Month  = date.Month,
                Day    = date.Day,
                Hour   = date.Hour,
                Minute = date.Minute,
                Second = date.Second
            };

            try
            {
                var toDelete = (FirebaseObject <FirebaseDataTime>)(await firebase
                                                                   .Child("DateTimeStock")
                                                                   .OnceAsync <FirebaseDataTime>());

                await firebase
                .Child("DateTimeStock")
                .Child(toDelete.Key)
                .DeleteAsync();

                await firebase
                .Child("DateTimeStock")
                .PostAsync <FirebaseDataTime>(dataTime);
            }
            catch (Exception ex)
            {
                await firebase
                .Child("DateTimeStock")
                .PostAsync <FirebaseDataTime>(dataTime);
            }
        }
        public override async Task Sync()
        {
            if (firebase != null)
            {
                if (!System.IO.File.Exists(FileManager.ordersFilePath))
                {
                    try
                    {
                        // FirebaseMetaData metaDataOrders = await firebase
                        //.Child("Documents")
                        //.Child("SamsonTech")
                        //.Child("Orders.txt")
                        //.GetMetaDataAsync();
                        // DateTime firebaseDateOrders = metaDataOrders.Updated;

                        List <FirebaseDataTime> firebaseDatas = await GetDateTimeOrders();

                        FirebaseDataTime firebaseDateOrders = firebaseDatas[0];

                        DateTime dateOrders = System.IO.File.GetLastWriteTime(FileManager.ordersFilePath);

                        if (firebaseDateOrders.Year == dateOrders.Year)
                        {
                            if (firebaseDateOrders.Month == dateOrders.Month)
                            {
                                if (firebaseDateOrders.Day == dateOrders.Day)
                                {
                                    if (firebaseDateOrders.Hour == dateOrders.Hour)
                                    {
                                        if (firebaseDateOrders.Minute == dateOrders.Minute)
                                        {
                                            if (firebaseDateOrders.Second < dateOrders.Second)
                                            {
                                                await SaveOrders();
                                            }
                                            else
                                            {
                                                await TryGetOrders();
                                            }
                                        }
                                        else if (firebaseDateOrders.Minute < dateOrders.Minute)
                                        {
                                            await SaveOrders();
                                        }
                                        else
                                        {
                                            await TryGetOrders();
                                        }
                                    }
                                    else if (firebaseDateOrders.Hour < dateOrders.Hour)
                                    {
                                        await SaveOrders();
                                    }
                                    else
                                    {
                                        await TryGetOrders();
                                    }
                                }
                                else if (firebaseDateOrders.Day < dateOrders.Day)
                                {
                                    await SaveOrders();
                                }
                                else
                                {
                                    await TryGetOrders();
                                }
                            }
                            else if (firebaseDateOrders.Month < dateOrders.Month)
                            {
                                await SaveOrders();
                            }
                            else
                            {
                                await TryGetOrders();
                            }
                        }
                        else if (firebaseDateOrders.Year < dateOrders.Year)
                        {
                            await SaveOrders();
                        }
                        else
                        {
                            await TryGetOrders();
                        }
                    }
                    catch (Exception ex)
                    {
                        await SaveOrders();
                    }
                }
                else
                {
                    await TryGetOrders();
                }



                if (!System.IO.File.Exists(FileManager.stocksFilePath))
                {
                    try
                    {
                        //FirebaseMetaData metaDataStocks = await new FirebaseStorage("samsontech-ebf50.appspot.com")
                        //    .Child("Documents")
                        //    .Child("SamsonTech")
                        //    .Child("Items.txt")
                        //    .GetMetaDataAsync();

                        //DateTime firebaseDateStock = metaDataStocks.Updated;
                        List <FirebaseDataTime> firebaseDatas = await GetDateTimeStocks();

                        FirebaseDataTime firebaseDateStock = firebaseDatas[0];

                        DateTime dateStocks = System.IO.File.GetLastWriteTime(FileManager.stocksFilePath);

                        if (firebaseDateStock.Year == dateStocks.Year)
                        {
                            if (firebaseDateStock.Month == dateStocks.Month)
                            {
                                if (firebaseDateStock.Day == dateStocks.Day)
                                {
                                    if (firebaseDateStock.Hour == dateStocks.Hour)
                                    {
                                        if (firebaseDateStock.Minute == dateStocks.Minute)
                                        {
                                            if (firebaseDateStock.Second < dateStocks.Second)
                                            {
                                                await SaveStock();
                                            }
                                            else
                                            {
                                                await TryGetStock();
                                            }
                                        }
                                        else if (firebaseDateStock.Minute < dateStocks.Minute)
                                        {
                                            await SaveStock();
                                        }
                                        else
                                        {
                                            await TryGetStock();
                                        }
                                    }
                                    else if (firebaseDateStock.Hour < dateStocks.Hour)
                                    {
                                        await SaveStock();
                                    }
                                    else
                                    {
                                        await TryGetStock();
                                    }
                                }
                                else if (firebaseDateStock.Day < dateStocks.Day)
                                {
                                    await SaveStock();
                                }
                                else
                                {
                                    await TryGetStock();
                                }
                            }
                            else if (firebaseDateStock.Month < dateStocks.Month)
                            {
                                await SaveStock();
                            }
                            else
                            {
                                await TryGetStock();
                            }
                        }
                        else if (firebaseDateStock.Year < dateStocks.Year)
                        {
                            await SaveStock();
                        }
                        else
                        {
                            await TryGetStock();
                        }
                    }
                    catch (Exception ex)
                    {
                        await SaveStock();
                    }
                }
                else
                {
                    await TryGetStock();
                }

                ToastManager.Show("Successfully Synced");

                try
                {
                    if (menu != null)
                    {
                        menu.FillTodayOrders();
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }