public DailyLog(IMapperProcessor mapperProcessor, IReadOnlyList <Meal> meals)
        {
            if (meals == null)
            {
                throw new ArgumentNullException(nameof(meals));
            }

            _mapperProcessor = mapperProcessor ?? throw new ArgumentNullException(nameof(mapperProcessor));
            PrepareDictionary(meals);
        }
        public ProducersViewModel(IQueryProcessor queryProcessor, ICommandProcessor commandProcessor, IMapperProcessor mapperProcessor)
        {
            _mapperProcessor  = mapperProcessor ?? throw new ArgumentNullException(nameof(mapperProcessor));
            _queryProcessor   = queryProcessor ?? throw new ArgumentNullException(nameof(queryProcessor));
            _commandProcessor = commandProcessor ?? throw new ArgumentNullException(nameof(commandProcessor));

            _producers = new ObservableCollection <Models.Producer>(GetProducers());

            ProducersView = CollectionViewSource.GetDefaultView(_producers);
            ProducersView.SortDescriptions.Add(new SortDescription(nameof(Models.Producer.Name), ListSortDirection.Ascending));

            DeleteProducer = new RelayCommand(DeleteProducerHandler);
        }
        public MainWindowViewModel(IQueryProcessor queryProcessor, ICommandProcessor commandProcessor, IMapperProcessor mapperProcessor)
        {
            _mapperProcessor  = mapperProcessor ?? throw new ArgumentNullException(nameof(mapperProcessor));
            _queryProcessor   = queryProcessor ?? throw new ArgumentNullException(nameof(queryProcessor));
            _commandProcessor = commandProcessor ?? throw new ArgumentNullException(nameof(commandProcessor));

            var data = GetData();

            _recipes    = new ObservableCollection <Models.Recipe>(data.Item1);
            RecipesView = CollectionViewSource.GetDefaultView(_recipes);
            RecipesView.SortDescriptions.Add(new SortDescription(nameof(Models.Recipe.Name), ListSortDirection.Ascending));
            SelectedRecipe = _recipes.First();

            _products    = new ObservableCollection <Models.Product>(data.Item2);
            ProductsView = CollectionViewSource.GetDefaultView(_products);
            ProductsView.SortDescriptions.Add(new SortDescription(nameof(Models.Product.IsFavourite), ListSortDirection.Descending));
            ProductsView.SortDescriptions.Add(new SortDescription(nameof(Models.Product.NameAndProducer), ListSortDirection.Ascending));
            SelectedProduct = _products.First();

            _meals    = new ObservableCollection <Models.Meal>(data.Item3);
            MealsView = CollectionViewSource.GetDefaultView(_meals);
            MealsView.SortDescriptions.Add(new SortDescription(nameof(Models.Meal.Name), ListSortDirection.Ascending));
            SelectedMeal = _meals.First();

            SelectedDate        = DateTime.Now.Date;
            SelectedDateForCopy = DateTime.Now.Date;

            Unit = "gr / ml";

            AddProductToDiary = new RelayCommand(AddProductToDiaryHandler, o => SelectedProduct != null && _amountOfProductConsumed > 0 && SelectedMeal != null);
            AddRecipeToDiary  = new RelayCommand(AddRecipeToDiaryHandler, o => SelectedRecipe != null && _servingsEaten > 0 && SelectedMeal != null);
            CopyToDiary       = new RelayCommand(CopyToDiaryHandler, o => SelectedMealForCopy != null);
            DeleteFoodLog     = new RelayCommand(DeleteFoodLogHandler);

            Task.Run(() => {
                while (true)
                {
                    Thread.Sleep(10000);
                    var newData = GetData();

                    LoadNewData(newData.Item1, _recipes, new RecipeComparer());
                    LoadNewData(newData.Item2, _products, new ProductComparer());
                    LoadNewData(newData.Item3, _meals, new MealComparer());
                }
            });
        }