private void buttonAddNew_Click(object sender, EventArgs e)
        {
            string name = textBoxName.Text;
            bool   nameAlreadyExists = false;

            if (name == "")
            {
                MessageBox.Show("Please fill out the name textbox");
                return;
            }

            // Check if the name exists
            foreach (var muscleGroup in MuscleGroup.muscleGroupList)
            {
                if (name == muscleGroup.muscle_group_details)
                {
                    MessageBox.Show("Muscle Groups already exists.  Please pick a new name");
                    nameAlreadyExists = false;
                    break;
                }
            }

            // If the name is new, send it to the API
            if (!nameAlreadyExists)
            {
                APIRequests request = new APIRequests();

                string url = $"{request.allMuscleGroupsEndpoint}/{name}";

                var response = request.SendPostRequestData(url);

                if (response.Contains("Successfully"))
                {
                    MessageBox.Show("Sucessfully added a new muscle group");

                    textBoxName.Text = "";

                    ResetMuscleGroupView();
                }
            }
        }
        /// <summary>
        /// This is called when the user wants to save their changes
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonSave_Click(object sender, EventArgs e)
        {
            string id          = textBoxSessionId.Text;
            string name        = textBoxName.Text;
            string description = textBoxDescription.Text;
            string sets        = textBoxTrainingSessionSets.Text;
            string reps        = textBoxTrainingSessionReps.Text;
            string active      = checkBoxActive.Checked.ToString();

            TrainingSession newSession = new TrainingSession(id, name, description, sets, reps, active);

            // Convert the object to JSON
            string jsonSession = JsonConvert.SerializeObject(newSession);

            logger.Debug(jsonSession);

            //TODO: Finish up modifying the training session.  Make sure the methods are created first
            APIRequests request = new APIRequests();

            string url = $"{request.singleTrainingSessionEndpoint}{id}";

            logger.Debug(url);

            // Patch the training session
            var response = request.SendPatchRequestDataInBody(url, jsonSession);

            // Check the resulting json for results
            if (response.Contains("Successfully"))
            {
                // Check for new exercises to be added to the training session

                CheckForNewSessions();

                if (exercisesToAdd.Count != 0)
                {
                    // Foreach, send patch request
                    foreach (var exercise in exercisesToAdd)
                    {
                        url = $"{request.singleTrainingSessionEndpoint}{exercise.Value}/exercise/{exercise.Key}";

                        var exerciseResponse = request.SendPostRequestData(url);

                        if (exerciseResponse.Contains("error"))
                        {
                            MessageBox.Show(exerciseResponse);
                            logger.Error(exerciseResponse);
                        }
                    }
                }


                // Check for removed exericeses
                CheckForDeletedSessions();

                if (exercisesToremove.Count != 0)
                {
                    foreach (var exercise in exercisesToremove)
                    {
                        url = $"{request.singleTrainingSessionEndpoint}{exercise.Value}/exercise/{exercise.Key}";

                        var exerciseResponse = request.SendDeleteRequestData(url);

                        if (exerciseResponse.Contains("error"))
                        {
                            MessageBox.Show(exerciseResponse);
                            logger.Error(exerciseResponse);
                        }
                    }
                }


                MessageBox.Show("Completed modifying the training session");

                this.Close();
            } // End of if statement
            else
            {
                MessageBox.Show("Couldn't modify the training session");
            }
        }
        private void buttonSave_Click(object sender, EventArgs e)
        {
            // TODO: This

            // Save user entered values as a new trainingSession
            string name        = textBoxName.Text;
            string description = textBoxDescription.Text;
            string sets        = textBoxTrainingSessionSets.Text;
            string reps        = textBoxTrainingSessionReps.Text;
            string active      = checkBoxActive.Checked.ToString().ToLower();

            TrainingSession newSession = new TrainingSession(name, description, sets, reps, active);

            // Convert the object to JSON
            string jsonSession = JsonConvert.SerializeObject(newSession);

            logger.Info(jsonSession);

            // Insert it into the database. Get the ID back from the tool
            var response = AddTrainingSessionTodatabase(jsonSession);

            if (response.Contains("Successfully added new training session"))
            {
                dynamic trainingSessionResponse = JObject.Parse(response);

                logger.Info("Response: " + trainingSessionResponse);

                var newSessionId = trainingSessionResponse.trainingSessionId;

                //logger.Info(newSessionId);

                //// Convert the training sessions

                string exercisesInTrainingSession = JsonConvert.SerializeObject(Exercise.exercisesForTrainingSession);

                //logger.Info("New exercises");
                //logger.Info(exercisesInTrainingSession);

                APIRequests request = new APIRequests();

                bool exerciseErrors = false;

                foreach (var exercise in Exercise.exercisesForTrainingSession)
                {
                    string exerciseId = exercise.exercise_id;

                    string url = $"{request.singleTrainingSessionEndpoint}{newSessionId}/exercise/{exerciseId}";
                    logger.Info(url);

                    string exerciseResponse = request.SendPostRequestData(url);

                    if (!exerciseResponse.Contains("Successfully"))
                    {
                        exerciseErrors = true;
                        logger.Error(exerciseResponse);
                    }
                }

                if (exerciseErrors)
                {
                    MessageBox.Show("There were errors inserting the exercises.  Please check the log files");
                }
                else
                {
                    TrainingSession.GetAllTrainingSessions();

                    MessageBox.Show("Successfully created the new training session");
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Something went wrong in saving the training session.");
                logger.Error(response);
            }
        }