public async Task DeleteAsync(int userId, int exerciseId) { var athlete = await _athleteRepository.FindByCondition(condition : a => a.UserId == userId, include : source => source.Include(a => a.AthleteExercises) .ThenInclude(ae => ae.Day) .Include(a => a.AthleteExercises) .ThenInclude(ae => ae.Exercise) .ThenInclude(e => e.PartOfBody)); if (athlete is null) { throw new AthleteNotFoundException(userId); } var exercise = athlete.AthleteExercises.SingleOrDefault(ae => ae.ExerciseId == exerciseId); if (exercise is null) { throw new ExerciseForAthleteNotFoundException(userId, exerciseId); } await _athleteRepository.RemoveExerciseAsync(athlete, exercise); await _athleteRepository.UpdateAsync(athlete); }