/// <summary>
        /// Create a new course and add it to the current user's course list
        /// </summary>
        /// <returns></returns>
        public Course CreateCourse(ref ObservableCollection<CourseMeta> crsMeta)
        {
            try
            {
                //Create the new Course
                Course newCourse = new Course();
                newCourse.Name = "New Course";
                newCourse.ID = Guid.NewGuid();

                //Add the new course to the current user's course list
                CoursePermission newCoursePermissions = new CoursePermission();
                newCoursePermissions.Course = newCourse;
                newCoursePermissions.CourseID = newCourse.ID;
                newCoursePermissions.LbcUser = Session.CurUser;
                newCoursePermissions.UserID = Session.CurUser.ID;
                newCoursePermissions.Permission = "Lead Writer";
                newCourse.CoursePermissions.Add(newCoursePermissions);

                //Create the course meta data
                CourseMeta newCourseMeta = new CourseMeta();
                newCourseMeta.CourseID = newCourse.ID;
                newCourseMeta.Permission = "Lead Writer";
                crsMeta.Add(newCourseMeta);

                //Add the course to the database context and the user's course list that's loaded into the program
                Session.DbContext.Add(newCourse);
                return newCourse;
            }
            catch
            {
                return null;
            }
        }
 /// <summary>
 /// Remove the selected course from the database
 /// </summary>
 /// <param name="crs"></param>
 /// <returns></returns>
 public bool DeleteCourse(Course crs)
 {
     try
     {
         Session.DbContext.Delete(crs);
         return true;
     }
     catch
     {
         return false;
     }
 }
        // =======================================================
        // Methods
        // =======================================================
        /// <summary>
        /// Create a new unit
        /// </summary>
        /// <param name="crs">The course to place the unit into</param>
        /// <returns></returns>
        public bool CreateNewUnit(Course crs)
        {
            try
            {
                Unit newUnit = new Unit();

                newUnit.ID = Guid.NewGuid();
                newUnit.CourseID = crs.ID;
                newUnit.Course = crs;
                newUnit.UnitName = "New Unit";
                newUnit.UnitNumber = (crs.Units.Count + 1);

                crs.Units.Add(newUnit);

                return true;
            }
            catch
            {
                //An error occured
                return false;
            }
        }
        public bool UpdateCourseExpectations(LbcExpectationIndex newIndex, Course crs, ref ObservableCollection<CourseMeta> metaData)
        {
            CourseMeta tmpMeta;

            try
            {
                //Update the course's expectation start and stop code
                crs.ExpectationCodeStart = long.Parse(newIndex.CodeStart);
                crs.ExpectationCodeStop = long.Parse(newIndex.CodeEnd);

                //Find the meta data record for the current course
                tmpMeta = metaData.Where(m => m.CourseID == crs.ID).First();

                //Load the new expectations for the given course
                if (crs.ExpectationCodeStart != null && crs.ExpectationCodeStop != null)
                {
                    tmpMeta.CourseExpectations = LoadCourseExpectations(crs.ExpectationCodeStart, crs.ExpectationCodeStop);
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
 /// <summary>
 /// Update the specified course's alignment and load the expectations into the course's metadata
 /// </summary>
 /// <param name="newIndex"></param>
 /// <param name="crs"></param>
 /// <returns></returns>
 public bool UpdateCourseAlignment(LbcExpectationIndex newIndex, Course crs)
 {
     return expectationModel.UpdateCourseExpectations(newIndex, crs, ref _CoursesMeta);
 }
        public bool DeleteCourse(Course crs)
        {
            ICourseModel crsModel = new CourseModel();

            try
            {

                Courses.Remove(crs);
                crsModel.DeleteCourse(crs);

                return true;
            }
            catch
            {
                return false;
            }
            finally
            {
                crsModel = null;
            }
        }
        /// <summary>
        /// Move a unit into a course
        /// </summary>
        /// <param name="unt">The unit to move</param>
        /// <param name="newCrs">The course that the unit is going into</param>
        /// <returns></returns>
        public bool MoveUnit(Unit unt, Course newCrs)
        {
            try
            {
                unt.CourseID = newCrs.ID;
                unt.Course = newCrs;

                //Remove the unit from its current course
                unt.Course.Units.Remove(unt);

                //Move the unit into its new course
                newCrs.Units.Add(unt);

                return true;
            }
            catch
            {
                //something went wrong
                return false;
            }
        }