// --------------------------------------------- EVENTS ---------------------------------------------------


        // Klicked ingredient in search window
        private void ListView_SearchIngredients_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            if (ListView_SearchIngredients.SelectedItem == null)
            {
                return;
            }

            int index = ((ObservableCollection <IngredientListModel>)ListView_SearchIngredients.ItemsSource).IndexOf((IngredientListModel)e.SelectedItem);

            ((ListView)sender).SelectedItem = null;
            IngredientDtoV2 selectedIngredient = SearchIngredients[index];

            SearchIngredientModels[index] = new IngredientListModel()
            {
                Ingredient = SearchIngredientModels[index].Ingredient,
                IsAdded    = !SearchIngredientModels[index].IsAdded,
                AddedColor = SearchIngredientModels[index].AddedColor,
                AddedIcon  = SearchIngredientModels[index].AddedIcon
            };

            if (SearchModeIncluded)
            {
                if (MyIngredients.Any(p => p.IngredientId == selectedIngredient.IngredientId))
                {
                    MyIngredientsRemoveAt(MyIngredients.FindIndex(p => p.IngredientId == selectedIngredient.IngredientId));
                }

                else
                {
                    MyIngredientsAdd(selectedIngredient);
                }
            }
            else
            {
                if (ExcludedIngredients.Any(p => p.IngredientId == selectedIngredient.IngredientId))
                {
                    ExcludedIngredientsRemoveAt(ExcludedIngredients.FindIndex(p => p.IngredientId == selectedIngredient.IngredientId));
                }

                else
                {
                    ExcludedIngredientsAdd(selectedIngredient);
                }
            }
        }
        // --------------------------------------------- REQUESTS ---------------------------------------------------


        // Recive ingredentDtos from the server and update lists
        async void GET_ingredientDtos(string search)
        {
            bool isLoading = true;

            ActivityIndicator_Ingredients.IsRunning = true;
            await Task.Factory.StartNew(() => SearchIngredients = ingredientsSearching.Search(search, out isLoading));

            SearchIngredientModels.Clear();

            if (SearchModeIncluded)
            {
                foreach (var ingredient in SearchIngredients)
                {
                    SearchIngredientModels.Add(new IngredientListModel()
                    {
                        Ingredient = ingredient,
                        IsAdded    = (MyIngredients.Any(p => p.IngredientId == ingredient.IngredientId)) ? true : false
                    });
                }
            }
            else
            {
                foreach (var ingredient in SearchIngredients)
                {
                    SearchIngredientModels.Add(new IngredientListModel()
                    {
                        Ingredient = ingredient,
                        IsAdded    = (ExcludedIngredients.Any(p => p.IngredientId == ingredient.IngredientId)) ? true : false,
                        AddedIcon  = Constants.ExcludeIngredientCheckIcon,
                        AddedColor = Color.Red
                    });
                }
            }

            if (!isLoading)
            {
                ActivityIndicator_Ingredients.IsRunning = false;
            }
        }