@Override
    public String assignTutorialToStudent(String modCode, String groupNum, String matricNum) {
        String result;
        moduleEntity = lookupModuleFromCode(modCode);
        if (moduleEntity == null) {
            return "Module not found!\n";
        }
        studentEntity = lookupStudent(matricNum);
        if (studentEntity == null) {
            return "Student not found!\n";
        }
        Collection<TutorialEntity> currTuts = moduleEntity.getTutorials();
        if (currTuts.isEmpty()) {
            return "Module has no associated tutorials!\n";
        }
        for (TutorialEntity tut : currTuts) {
            if (tut.getGroupNumber().equals(groupNum)) {
                tutorialEntity = tut;
                studentEntity.getTutorials().add(tutorialEntity);
                tutorialEntity.getStudents().add(studentEntity);
                em.persist(studentEntity);
                em.persist(tutorialEntity);
                em.flush();
                em.clear();
                result = "Student is successfully assigned to tutorial!\n";
                return result;
            }
        }
        return "Tutorial does not exist!\n";
    }