public void executeTask() {

        if (!isModifyAction()) {

            if (getSelectedStudent() == null) {
                showError("No Student Found", "Please select a student");
            } else if (courseList.isEmpty()) {
                showError("No Courses Found", "Please select at least one Course to proceed");
            }

            List savingList = new ArrayList();

            Iterator<Course> it = courseList.iterator();
            StudentRegisteredCourse srCourse = null;
            long sid = getSelectedStudent().getId();
            while (it.hasNext()) {
                Course course = it.next();
                srCourse = new StudentRegisteredCourse();

                srCourse.setCourseID(course.getId());
                srCourse.setStudentID(sid);
                savingList.add(srCourse);
            }

            boolean success = dao.saveStudentCourseRegistration(savingList);


        } else {

            List dueRomoveList = new ArrayList();
            List dueSaveList = new ArrayList();


            for (Course c : getOldCourseList()) {
                if (!getCourseList().contains(c)) {
                    dueRomoveList.add(c);
                }
            }
            long sid= getSelectedStudent().getId();
            for (Course c : getCourseList()) {

                if (!getOldCourseList().contains(c)) {
                    
                   StudentRegisteredCourse  srCourse = new StudentRegisteredCourse();

                srCourse.setCourseID(c.getId());
                srCourse.setStudentID(sid);
                    
                    dueSaveList.add(srCourse);
                }
            }

            dao.saveStudentCourseRegistration(dueSaveList);
          boolean b= dao.removeStudentCourseRegistration(dueRomoveList,getSelectedStudent());
            
        }


    }