public async Task <DTO.TrainingCycle> GetFullActiveCycleForUserWithIdAsync(Guid userId) { var fullTrainingCycle = await RepoDbSet .Include(cycle => cycle.WorkoutRoutine) .Include(cycle => cycle.TrainingWeeks) .ThenInclude(week => week.TrainingDays) .ThenInclude(day => day.TrainingDayType) .Include(cycle => cycle.TrainingWeeks) .ThenInclude(week => week.TrainingDays) .ThenInclude(day => day.ExercisesInTrainingDay) .ThenInclude(exerciseInTrainingDay => exerciseInTrainingDay.ExerciseType) .Include(cycle => cycle.TrainingWeeks) .ThenInclude(week => week.TrainingDays) .ThenInclude(day => day.ExercisesInTrainingDay) .ThenInclude(exerciseInTrainingDay => exerciseInTrainingDay.Exercise) .Include(cycle => cycle.TrainingWeeks) .ThenInclude(week => week.TrainingDays).ThenInclude(day => day.ExercisesInTrainingDay) .ThenInclude(exerciseInTrainingDay => exerciseInTrainingDay.ExerciseSets) .ThenInclude(set => set.SetType) .OrderBy(cycle => cycle.StartingDate) .FirstOrDefaultAsync(cycle => cycle.WorkoutRoutine !.AppUserId == userId && cycle.CycleNumber == RepoDbSet.Max(c => c.CycleNumber)); var mappedCycle = Mapper.MapDomainToDAL(fullTrainingCycle); return(mappedCycle); }