public PlannedExpensesOfAllDetailedCatVm GetPlannedExpensesOfMainCPerMonth(DateTime monthOfYear, int mainCategoryId)
        {
            string   mainCategoryName = _mainCRepo.GetMainCategoryNameById(mainCategoryId);
            DateTime date             = FirstDayOfMonthFromDateTime(monthOfYear);
            var      model            = new PlannedExpensesOfAllDetailedCatVm()
            {
                MonthOfYear      = date,
                MainCategoryId   = mainCategoryId,
                MainCategoryName = mainCategoryName
            };

            int countDetCategories = _mainCRepo.GetCountOfDetailedCategories(mainCategoryId);

            if (countDetCategories != 0)
            {
                bool isPlanned = CheckIfMonthWasPlanned(date);
                if (isPlanned)
                {
                    CreatePlannedExpensesForNewDetailedCategories(mainCategoryId, date);
                    var plannedExpenses = GetPlannedExpensesFromDetailedCategories(mainCategoryId, date);
                    model.PlannedExpOfDetailedCat = plannedExpenses;
                    model.Count = plannedExpenses.Count;
                }
                else
                {
                    //there are detailed categories, but not planned for the month.
                    model.Count = -1;
                }
            }
            return(model);
        }