public async Task <IActionResult> EditWorkout(WorkoutViewModel workoutViewModel)
        {
            var user = await GetCurrentUserAsync();

            if (!ModelState.IsValid)
            {
                return(View(workoutViewModel));
            }

            if (workoutViewModel == null)
            {
                return(View("/Error"));
            }

            //Creating new entry
            var newWorkoutEntry = new NewWorkoutEntryDto
            {
                ExerciseId = workoutViewModel.ExerciseId,
                Set        = workoutViewModel.Set,
                Reps       = workoutViewModel.Reps,
                Weight     = workoutViewModel.Weight
            };

            //Adding to DTO
            var dto = new AddWorkoutEntryToWorkoutDto
            {
                WorkoutId        = workoutViewModel.Id,
                UserId           = user.Id,
                WorkoutEntryDtos = new List <NewWorkoutEntryDto>()
            };

            dto.WorkoutEntryDtos.Add(newWorkoutEntry);

            //Post to database
            var result = await _workoutService.AddWorkoutEntryAsync(dto);

            if (result < 1)
            {
                return(View("/Error"));
            }


            //Return to page with added entry
            var workoutToUpdate = await _workoutService.GetWorkoutAsync(workoutViewModel.Id);

            var exercises = await _exerciseService.GetAllExercisesAsync();

            var model = _mapper.Map <WorkoutViewModel>(workoutToUpdate);

            model.Exercises      = exercises.ToList() ?? new List <ExerciseDto>();
            model.WorkoutEntries =
                _mapper.Map <ICollection <WorkoutEntryDto>, IEnumerable <WorkoutEntryViewModel> >(workoutToUpdate
                                                                                                  .WorkoutEntryDtos);

            return(View(model));
        }