public (List <StopTime>, List <StopTime>, List <StopTime>) FetchStopTimes(List <int> routeIds)
        {
            var combinedTimeTableDatas = _documentStoreRepository.GetTimeTableDataByRouteId(routeIds);
            var dates = combinedTimeTableDatas.Select(x => x.Date).Distinct().ToList();

            var(weekday, saturday, sunday) = _dateChecker.GetDates(dates);

            var weekdayTtds  = combinedTimeTableDatas.Where(x => x.Date.Date == weekday.Date).ToList();
            var saturdayTtds = combinedTimeTableDatas.Where(x => x.Date.Date == saturday.Date).ToList();
            var sundayTtds   = combinedTimeTableDatas.Where(x => x.Date.Date == sunday.Date).ToList();

            var weekDayCombinedStopTimes  = weekdayTtds.SelectMany(x => x.StopTimes).ToList();
            var saturdayCombinedStopTimes = saturdayTtds.SelectMany(x => x.StopTimes).ToList();
            var sundayCombinedStopTimes   = sundayTtds.SelectMany(x => x.StopTimes).ToList();

            return(weekDayCombinedStopTimes, saturdayCombinedStopTimes, sundayCombinedStopTimes);
        }
        public void ChangeTimeTableJsonsToObjectsAndSaveToDb(List <StopTimeUrl> convertedStopTimes, List <TimeTableDateTime> entitiesThatWerentDownloaded)
        {
            foreach (var stopTime in convertedStopTimes)
            {
                try
                {
                    var notDownloadedEntitiesByRouteId =
                        entitiesThatWerentDownloaded.Where(x => x.RouteId == stopTime.RouteId).ToList();
                    var entitiesToDelete = _documentStoreRepository.GetTimeTableDataByRouteId(stopTime.RouteId);

                    if (notDownloadedEntitiesByRouteId.Count > 0)
                    {
                        entitiesToDelete = _filterHelper.Filter(entitiesToDelete, notDownloadedEntitiesByRouteId);
                    }

                    var jsonsToConvert    = _documentStoreRepository.GetJsonsByRouteId(stopTime.RouteId);
                    var timeTableDataList = new List <TimeTableData>();

                    if (jsonsToConvert.Count <= 0)
                    {
                        continue;
                    }

                    foreach (var item in jsonsToConvert)
                    {
                        var jsonAsJObject = JsonConvert.DeserializeObject <JObject>(item.Json);
                        timeTableDataList.Add(_converter.Deserialize(jsonAsJObject));
                    }

                    timeTableDataList = timeTableDataList.Where(x => x.StopTimes.Count > 0).ToList();

                    _documentStoreRepository.Save(timeTableDataList);
                    _documentStoreRepository.Delete(jsonsToConvert.Select(x => x.Id).ToList());
                    _documentStoreRepository.Delete(entitiesToDelete.Select(x => x.Id).ToList());
                }
                catch (Exception e)
                {
                    var mes = e.Message;
                }
            }
        }