public async Task <IEnumerable <ModelSectiune> > Handle(ModelFormular.IntrebariQuery message)
        {
            CacheObjectsName formular;

            Enum.TryParse("Formular" + message.CodFormular, out formular); // TODO why enum here?

            return(await _cacheService.GetOrSaveDataInCacheAsync <IEnumerable <ModelSectiune> >(formular,
                                                                                                async() =>
            {
                var r = await _context.Questions
                        .Include(a => a.FormSection)
                        .Include(a => a.OptionsToQuestions)
                        .ThenInclude(a => a.Option)
                        .Where(a => a.FormCode == message.CodFormular)
                        .ToListAsync();

                var sectiuni = r.Select(a => new { IdSectiune = a.IdSection, CodSectiune = a.FormSection.Code, Descriere = a.FormSection.Description }).Distinct();

                var result = sectiuni.Select(i => new ModelSectiune
                {
                    CodSectiune = i.CodSectiune,
                    Descriere = i.Descriere,
                    Intrebari = r.Where(a => a.IdSection == i.IdSectiune)
                                .OrderBy(intrebare => intrebare.Id)
                                .Select(a => _mapper.Map <ModelIntrebare>(a)).ToList()
                }).ToList();
                return result;
            },
                                                                                                new DistributedCacheEntryOptions
            {
                AbsoluteExpirationRelativeToNow = new TimeSpan(message.CacheHours, message.CacheMinutes, message.CacheMinutes)     // TODO CacheSeconds should be last?
            }));
        }
        public async Task <IEnumerable <ModelSectiune> > Handle(ModelFormular.IntrebariQuery message)
        {
            CacheObjectsName formular;

            Enum.TryParse("Formular" + message.CodFormular, out formular);

            return(await _cacheService.GetOrSaveDataInCacheAsync <IEnumerable <ModelSectiune> >(formular,
                                                                                                async() =>
            {
                var r = await _context.Intrebare
                        .Include(a => a.IdSectiuneNavigation)
                        .Include(a => a.RaspunsDisponibil)
                        .ThenInclude(a => a.IdOptiuneNavigation)
                        .Where(a => a.CodFormular == message.CodFormular)
                        .ToListAsync();

                var sectiuni = r.Select(a => new { a.IdSectiune, a.IdSectiuneNavigation.CodSectiune, a.IdSectiuneNavigation.Descriere }).Distinct();

                var result = sectiuni.Select(i => new ModelSectiune
                {
                    CodSectiune = i.CodSectiune,
                    Descriere = i.Descriere,
                    Intrebari = r.Where(a => a.IdSectiune == i.IdSectiune)
                                .OrderBy(intrebare => intrebare.CodIntrebare)
                                .Select(a => _mapper.Map <ModelIntrebare>(a)).ToList()
                }).ToList();
                return result;
            },
                                                                                                new DistributedCacheEntryOptions
            {
                AbsoluteExpirationRelativeToNow = new TimeSpan(message.CacheHours, message.CacheMinutes, message.CacheMinutes)
            }));
        }