public async Task <List <DataWrapper> > GetEvents(DateTime selectedDate)
        {
            List <DataWrapper> response = new List <DataWrapper>();
            var year = await YearService.GetByYear(selectedDate.Year);

            if (year != null)
            {
                var prevMonth = await MonthService.GetByMonthAndYearId(selectedDate.AddMonths(-1).Month, year.Id);

                if (prevMonth != null)
                {
                    var days = await DayService.GetLasyDaysByMonthId(prevMonth.Id);

                    foreach (var day in days)
                    {
                        var events = await EventService.GetAllByDayId(day.Id);

                        if (events.Count > 0)
                        {
                            response.Add(new DataWrapper(day, events));
                        }
                    }
                }
                var nextMonth = await MonthService.GetByMonthAndYearId(selectedDate.AddMonths(1).Month, year.Id);

                if (nextMonth != null)
                {
                    var days = await DayService.GetFirstDaysByMonthId(nextMonth.Id);

                    foreach (var day in days)
                    {
                        var events = await EventService.GetAllByDayId(day.Id);

                        if (events.Count > 0)
                        {
                            response.Add(new DataWrapper(day, events));
                        }
                    }
                }
                var month = await MonthService.GetByMonthAndYearId(selectedDate.Month, year.Id);

                if (month != null)
                {
                    var days = await DayService.GetByMonthId(month.Id);

                    foreach (var day in days)
                    {
                        var events = await EventService.GetAllByDayId(day.Id);

                        if (events.Count > 0)
                        {
                            response.Add(new DataWrapper(day, events));
                        }
                    }
                }
            }

            return(response);
        }
        public async Task <int> CreateRelationsAndSaveEvent(Event _event, DateTime date)
        {
            if (_event != null)
            {
                var year = await YearService.GetByYear(date.Year);

                if (year == null)
                {
                    year = await YearService.Save(new YearModel()
                    {
                        Year = date.Year
                    });
                }

                var month = await MonthService.GetByMonthAndYearId(date.Month, year.Id);

                if (month == null)
                {
                    month = await MonthService.Save(new MonthModel()
                    {
                        Month = date.Month, YearId = year.Id
                    });
                }

                var day = await DayService.GetByDayAndMonthId(date.Day, month.Id);

                if (day == null)
                {
                    day = await DayService.Save(new DayModel()
                    {
                        Day = date.Day, MonthId = month.Id, Date = date
                    });
                }

                _event.DayId = day.Id;
                var eventId = await EventService.Save(_event);

                return(eventId);
            }
            else
            {
                return(0);
            }
        }
        public async Task <string> GetDayEmoji(DateTime date)
        {
            var year = await YearService.GetByYear(date.Year);

            if (year != null)
            {
                var month = await MonthService.GetByMonthAndYearId(date.Month, year.Id);

                if (month != null)
                {
                    var day = await DayService.GetByDayAndMonthId(date.Day, month.Id);

                    if (day != null)
                    {
                        return(day.Emoji);
                    }
                }
            }
            return("☺");
        }
        public async Task SetEmojiOnDay(DateTime date, string emoji)
        {
            var year = await YearService.GetByYear(date.Year);

            if (year == null)
            {
                year = await YearService.Save(new YearModel()
                {
                    Year = date.Year
                });
            }

            var month = await MonthService.GetByMonthAndYearId(date.Month, year.Id);

            if (month == null)
            {
                month = await MonthService.Save(new MonthModel()
                {
                    Month = date.Month, YearId = year.Id
                });
            }

            var day = await DayService.GetByDayAndMonthId(date.Day, month.Id);

            if (day == null)
            {
                await DayService.Save(new DayModel()
                {
                    Day = date.Day, MonthId = month.Id, Date = date, Emoji = emoji
                });
            }
            else
            {
                await DayService.SetEmoji(emoji, day.Id);
            }
            //await DayService.SetEmoji(emoji, day.Id);
        }