/// <summary>
        /// Saves the info from the grading list
        /// </summary>
        /// <param name="action">Determines how the learner assignment statud should be handled.</param>
        private void SaveGradingList(SaveAction action)
        {
            // gradingList.DeterminePostBackGradingItems() only returns the rows that have changed
            Dictionary <string, GradingItem>   gradingListItems      = gradingList.DeterminePostBackGradingItems();
            List <LearnerAssignmentProperties> gradingPropertiesList = new List <LearnerAssignmentProperties>();

            if (action == SaveAction.CollectAll || action == SaveAction.ReturnAll)
            {
                foreach (GradingItem item in gradingList.Items.Values)
                {
                    switch (action)
                    {
                    case SaveAction.CollectAll:
                        if (item.Status == LearnerAssignmentState.NotStarted || item.Status == LearnerAssignmentState.Active)
                        {
                            gradingListItems[item.LearnerAssignmentId.ToString(CultureInfo.InvariantCulture)] = item;
                        }
                        break;

                    case SaveAction.ReturnAll:
                        if (item.Status != LearnerAssignmentState.Final)
                        {
                            gradingListItems[item.LearnerAssignmentId.ToString(CultureInfo.InvariantCulture)] = item;
                        }
                        break;
                    }
                }
            }

            if (gradingListItems.Count > 0)
            {
                using (AssignmentSaver saver = AssignmentProperties.CreateSaver())
                {
                    bool hasSaved = false;
                    try
                    {
                        foreach (GradingItem item in gradingListItems.Values)
                        {
                            bool moveStatusForward = false;
                            bool returnAssignment  = false;
                            LearnerAssignmentProperties gradingProperties = AssignmentProperties[item.LearnerAssignmentId];
                            gradingProperties.FinalPoints        = item.FinalScore;
                            gradingProperties.Grade              = item.Grade;
                            gradingProperties.InstructorComments = item.InstructorComments;

                            // Ignore the FinalScore Update if the Status is NotStarted or Active
                            if (item.Status == LearnerAssignmentState.NotStarted || item.Status == LearnerAssignmentState.Active)
                            {
                                gradingProperties.IgnoreFinalPoints = true;
                            }

                            switch (action)
                            {
                            case SaveAction.SaveOnly:
                                // The Save or OK button was clicked
                                moveStatusForward = item.ActionState;
                                break;

                            case SaveAction.CollectAll:
                                // The Collect All button was clicked
                                if (item.Status == LearnerAssignmentState.NotStarted || item.Status == LearnerAssignmentState.Active)
                                {
                                    moveStatusForward = true;
                                }
                                break;

                            case SaveAction.ReturnAll:
                                if (item.Status != LearnerAssignmentState.Final)
                                {
                                    returnAssignment = true;
                                }
                                break;
                            }

                            gradingProperties.Save(moveStatusForward, returnAssignment, saver);
                        }

                        hasSaved = true;
                        saver.Save();
                    }
                    catch
                    {
                        if (hasSaved == false)
                        {
                            saver.Cancel();
                        }

                        throw;
                    }
                }
            }
        }