/// <summary>
 /// New course module allocation
 /// </summary>
 /// <param name="courseId"></param>
 /// <param name="moduleId"></param>
 /// <returns></returns>
 public int AddModuleToCourse(int courseId, int moduleId)
 {
     //course module id generated
     var courseModuleId = CourseModuleIdGeneration();
     //as long as id passed in for generation valid object created and added to database
     if (courseId != 0 && moduleId != 0 && moduleId != 0)
     {
         //new course module object created
         var courseModule = new CourseModule
         {
             CourseModuleId = courseModuleId,
             Course = courseId,
             Module = moduleId
         };
         //course module added to database
         _dBase.CourseModules.Add(courseModule);
         _dBase.SaveChanges();
         //course module id returned
         return courseModuleId;
     }
     //course module allocation failed 0 returned
     return 0;
 }
        /// <summary>
        /// addition of module to course 
        /// </summary>
        /// <param name="modules"></param>
        /// <param name="courseId"></param>
        /// <returns></returns>
        public bool AddModulesToCourse(List<Module> modules, int courseId)
        {
            if (modules.Count != 0 && courseId != 0)
            {   // modules selceted from database to create new course module records
                var allocatedCourseModules = _dBase.CourseModules.Where(x => x.Course == courseId);

                //Removal of current course modules
                foreach (var cm in allocatedCourseModules)
                {
                    _dBase.CourseModules.Remove(cm);
                }
                //new course modules generated
                foreach (var m in modules)
                {
                    //new course module  idcreated
                    var courseModuleId = CourseModuleIdGeneration();

                    var courseModule = new CourseModule
                    {
                        Course = courseId,
                        Module = m.ModuleId,
                        CourseModuleId = courseModuleId
                    };
                    _dBase.CourseModules.Add(courseModule);
                    _dBase.SaveChanges();
                }
                return true;
            }
            return false;
        }