src/main/java/seedu/address/logic/commands/commandUnassign/UnassignAssignmentFromCourseCommand.java
@Override
    protected void preprocessUndoableCommand(Model model) throws CommandException {
        // Check whether both IDs even exists
        ID courseID = this.assignDescriptor.getAssignID(PREFIX_COURSEID);
        ID assignmentID = this.assignDescriptor.getAssignID(PREFIX_ASSIGNMENTID);

        boolean courseExists = model.has(courseID, Constants.ENTITY_TYPE.COURSE);
        boolean assignmentExists = model.has(assignmentID, Constants.ENTITY_TYPE.ASSIGNMENT);

        if (!courseExists) {
            throw new CommandException(MESSAGE_INVALID_COURSE_ID);
        } else if (!assignmentExists) {
            throw new CommandException(MESSAGE_INVALID_ASSIGNMENT_ID);
        } else {
            Course assignedCourse = (Course) model.get(courseID, Constants.ENTITY_TYPE.COURSE);
            Assignment assigningAssignment = (Assignment) model.get(assignmentID, Constants.ENTITY_TYPE.ASSIGNMENT);

            boolean assignedCourseContainsAssignment = assignedCourse.containsAssignment(assignmentID);
            boolean assigningAssignmentContainsCourse = assigningAssignment.isAssignedToCourse();

            if (!assignedCourseContainsAssignment) {
                throw new CommandException(MESSAGE_INVALID_COURSE_NO_SUCH_ASSIGNMENT);
            } else if (!assigningAssignmentContainsCourse) {
                throw new CommandException(MESSAGE_INVALID_ASSIGNMENT_TO_COURSE);
            } else {
                Set<Progress> undoProgress = ProgressManager.getOneProgressFromAllStudents(courseID, assignmentID);
                this.undoProgresses = undoProgress;
            }
        }
    }
/**
     * This performs all two main action to ensure successful Unassigning of Assignment from Course and that
     * the command can undo & redo successfully.
     * 1. Check to ensure that the targeted Course & Assignment exists and that
     * 2. Prepare to add the removed 'Progress' objects back into the Progress AddressBook if the user decides to undo
     *
     * @param model
     */
This performs all two main action to ensure successful Unassigning of Assignment from Course and that
the command can undo & redo successfully.
1. Check to ensure that the targeted Course & Assignment exists and that
2. Prepare to add the removed 'Progress' objects back into the Progress AddressBook if the user decides to undo

@param model
This performs all two main action to ensure successful Unassigning of Assignment from Course and that the command can undo & redo successfully . 1 . Check to ensure that the targeted Course & Assignment exists and that 2 . Prepare to add the removed ' Progress ' objects back into the Progress AddressBook if the user decides to undo @param model
@Override
    protected void preprocessUndoableCommand(Model model) throws CommandException {
        ID courseID = this.assignDescriptor.getAssignID(PREFIX_COURSEID);
        ID assignmentID = this.assignDescriptor.getAssignID(PREFIX_ASSIGNMENTID);
        boolean courseExists = model.has(courseID, Constants.ENTITY_TYPE.COURSE);
        boolean assignmentExists = model.has(assignmentID, Constants.ENTITY_TYPE.ASSIGNMENT);
        if (!courseExists) {
            throw new CommandException(MESSAGE_INVALID_COURSE_ID);
        } else if (!assignmentExists) {
            throw new CommandException(MESSAGE_INVALID_ASSIGNMENT_ID);
        } else {
            Course assignedCourse = (Course) model.get(courseID, Constants.ENTITY_TYPE.COURSE);
            Assignment assigningAssignment = (Assignment) model.get(assignmentID, Constants.ENTITY_TYPE.ASSIGNMENT);
            boolean assignedCourseContainsAssignment = assignedCourse.containsAssignment(assignmentID);
            boolean assigningAssignmentContainsCourse = assigningAssignment.isAssignedToCourse();
            if (!assignedCourseContainsAssignment) {
                throw new CommandException(MESSAGE_INVALID_COURSE_NO_SUCH_ASSIGNMENT);
            } else if (!assigningAssignmentContainsCourse) {
                throw new CommandException(MESSAGE_INVALID_ASSIGNMENT_TO_COURSE);
            } else {
                Set<Progress> undoProgress = ProgressManager.getOneProgressFromAllStudents(courseID, assignmentID);
                this.undoProgresses = undoProgress;
            }
        }
    }
@ Override protected void preprocessUndoableCommand ( Model model ) throws CommandException { ID courseID = this . assignDescriptor . getAssignID ( PREFIX_COURSEID ) ; ID assignmentID = this . assignDescriptor . getAssignID ( PREFIX_ASSIGNMENTID ) ; boolean courseExists = model . has ( courseID , Constants . ENTITY_TYPE . COURSE ) ; boolean assignmentExists = model . has ( assignmentID , Constants . ENTITY_TYPE . ASSIGNMENT ) ; if ( ! courseExists ) { throw new CommandException ( MESSAGE_INVALID_COURSE_ID ) ; } else if ( ! assignmentExists ) { throw new CommandException ( MESSAGE_INVALID_ASSIGNMENT_ID ) ; } else { Course assignedCourse = ( Course ) model . get ( courseID , Constants . ENTITY_TYPE . COURSE ) ; Assignment assigningAssignment = ( Assignment ) model . get ( assignmentID , Constants . ENTITY_TYPE . ASSIGNMENT ) ; boolean assignedCourseContainsAssignment = assignedCourse . containsAssignment ( assignmentID ) ; boolean assigningAssignmentContainsCourse = assigningAssignment . isAssignedToCourse ( ) ; if ( ! assignedCourseContainsAssignment ) { throw new CommandException ( MESSAGE_INVALID_COURSE_NO_SUCH_ASSIGNMENT ) ; } else if ( ! assigningAssignmentContainsCourse ) { throw new CommandException ( MESSAGE_INVALID_ASSIGNMENT_TO_COURSE ) ; } else { Set < Progress > undoProgress = ProgressManager . getOneProgressFromAllStudents ( courseID , assignmentID ) ; this . undoProgresses = undoProgress ; } } }
This performs all two main action to ensure successful Unassigning of Assignment from Course and that
 the command can undo & redo successfully.
This performs all two main action to ensure successful Unassigning of Assignment from Course and that the command can undo & redo successfully .
// Check whether both IDs even exists