/// <summary>
        /// Creates new routine with <see cref="SelectedExercisesList"/>
        /// as its exercises
        /// </summary>
        /// <param name="parameter">Routine name </param>
        private void CreateRoutine(object parameter)
        {
            // Casts routine name as parameter
            var routineName = parameter as string;

            // Creates new routine
            var newRoutine = new Routine
            {
                Name   = routineName as string,
                UserId = CurrentUser.Id,
            };


            // Save routine id string for adding exercises later
            var routineIdString = newRoutine.Id;

            // Adds new routine to the database
            db.Routines.Add(newRoutine);



            // Adds exercises selected by the user to the database
            foreach (var selectedExercise in SelectedExercisesList.ToList())
            {
                var exercise = new RoutineExercise {
                    RoutineId  = routineIdString,
                    ExerciseId = selectedExercise.Id
                };

                db.RoutineExercises.Add(exercise);
            }

            // Save changes to the database
            SaveDbChanges();
        }
 /// <summary>
 /// Deletes all of the selected exercises
 /// </summary>
 /// <param name="message"></param>
 private void ClearExercises(NotificationMessage message)
 {
     // Checks if the message notification matches
     if (message.Notification == "ClearExercises")
     {
         foreach (var exercise in SelectedExercisesList.ToList())
         {
             exercise.IsSelected = false;
         }
         // Clears the list
         SelectedExercisesList.Clear();
     }
 }
        /// <summary>
        /// Selects an exercise
        /// </summary>
        /// <param name="obj"></param>
        private void SelectExercises(PropertyChangedMessage <AvailableExerciseListItemViewModel> obj)
        {
            // Checks if the object is null
            if (obj != null)
            {
                // Checks the property name
                if (obj.PropertyName == "ExerciseSelected")
                {
                    // Creates new exercise from the object value
                    var exercise = obj.NewValue;

                    bool doesExist = false;
                    // If the list is empty, add the exercise
                    if (SelectedExercisesList.ToList().Count == 0)
                    {
                        SelectedExercisesList.Add(exercise);
                    }
                    // Else looks for the exercise in the Selected Exercises List
                    else
                    {
                        // Using .ToList() to execute enumeration operation
                        foreach (var selectedExercise in SelectedExercisesList.ToList())
                        {
                            // If exercise already exists in this list that means the exercise was deselected
                            if (exercise.Id == selectedExercise.Id)
                            {
                                doesExist = true;
                                SelectedExercisesList.Remove(selectedExercise);
                            }
                        }

                        if (doesExist == false)
                        {
                            SelectedExercisesList.Add(exercise);
                        }
                    }
                }
            }
        }