private async void favouriteImage_Tapped(object sender, EventArgs e)
        {
            try
            {
                if (Application.Current.Properties.ContainsKey("isLoggedIn"))
                {
                    Config.ShowDialog();
                    var image = (CachedImage)sender;
                    if (image.GestureRecognizers.Count > 0)
                    {
                        var tap     = (TapGestureRecognizer)image.GestureRecognizers[0];
                        var product = (Product)tap.CommandParameter;

                        Dictionary <string, int> favouriteProduct = new Dictionary <string, int>();
                        favouriteProduct.Add("user_id", int.Parse(Application.Current.Properties["user_id"].ToString()));
                        favouriteProduct.Add("product_id", product.id);
                        var response = await ProductLogic.AddFavouriteProduct(favouriteProduct);

                        if (response.status == 200)
                        {
                            HomeVM.MyFavCounter = response.fav_count;
                            MessagingCenter.Send((App)Application.Current, "NavigationBar", _pageTitle);
                            //ViewModel.FavouriteProducts.Remove(ViewModel.FavouriteProducts.Where(p => p.id == int.Parse(productId)).Single());
                            var prod = ViewModel.Products.Where(p => p.id == product.id).FirstOrDefault();
                            if (prod != null)
                            {
                                if (response.favourite_status == "0")
                                {
                                    prod.favourite = "Favourites.png";
                                    image.Source   = "Favourites.png";
                                }
                                else
                                {
                                    prod.favourite = "Favourites_selected.png";
                                    image.Source   = "Favourites_selected.png";
                                }
                            }
                            Config.HideDialog();
                            Config.SnackbarMessage(response.message);
                        }
                        else
                        {
                            Config.HideDialog();
                            Config.SnackbarMessage(response.message);
                        }
                    }
                    Config.HideDialog();
                }
                else
                {
                    Config.HideDialog();
                    await Navigation.PushAsync(new LoginPage());
                }
            }
            catch (Exception ex)
            {
                Config.ErrorStore("ProductsPage-favouriteImage_Tapped", ex.Message);
                Config.HideDialog();
                Config.ErrorSnackbarMessage(Config.ApiErrorMessage);
            }
        }
        private async void addFavouriteTap_Tapped(object sender, EventArgs e)
        {
            try
            {
                if (Application.Current.Properties.ContainsKey("isLoggedIn"))
                {
                    Dictionary <string, int> favouriteProduct = new Dictionary <string, int>();
                    favouriteProduct.Add("user_id", int.Parse(Application.Current.Properties["user_id"].ToString()));
                    favouriteProduct.Add("product_id", _product.id);
                    var response = await ProductLogic.AddFavouriteProduct(favouriteProduct);

                    if (response.status == 200)
                    {
                        HomeVM.MyFavCounter = response.fav_count;
                        MessagingCenter.Send((App)Application.Current, "NavigationBar", _pageTitle);

                        if (response.favourite_status != "0")
                        {
                            Config.HideDialog();
                            favouriteIcon.Source = "Favourites_selected.png";
                        }
                        else
                        {
                            Config.HideDialog();
                            favouriteIcon.Source = "Favourites.png";
                        }
                        //var prod = ProductsPage.ViewModel.Products.Where(p => p.id == _product.id).FirstOrDefault();
                        //if (prod != null)
                        //{
                        //    if (response.favourite_status == "0")
                        //    {
                        //        prod.favourite = "Favourites.png";
                        //    }
                        //    else
                        //    {
                        //        prod.favourite = "Favourites_selected.png";
                        //    }
                        //}

                        Config.HideDialog();
                        Config.SnackbarMessage(response.message);
                        //await DisplayAlert("Success", response.message, "Ok");
                    }
                    else
                    {
                        Config.HideDialog();
                        Config.SnackbarMessage(response.message);
                    }
                }
                else
                {
                    Config.HideDialog();
                    await Navigation.PushAsync(new LoginPage());
                }
            }
            catch (Exception ex)
            {
                Config.ErrorStore("ProductDetailPage-addFavouriteTap_Tapped", ex.Message);
                Config.HideDialog();
                Config.ErrorSnackbarMessage(Config.ApiErrorMessage);
            }
        }