@Override
    public String assignModuleToStudent(String modCode, String matricNum) {
        String result;
        moduleEntity = lookupModuleFromCode(modCode);
        if (moduleEntity == null) {
            return "Module not found!\n";
        }
        studentEntity = lookupStudent(matricNum);
        if (studentEntity == null) {
            return "Student does not exist!\n";
        }
        studentEntity.getModules().add(moduleEntity);
        moduleEntity.getStudents().add(studentEntity);
        em.persist(moduleEntity);
        em.persist(studentEntity);
        em.flush();
        em.clear();
        result = "Student is successfully assigned to module\n";
        return result;
    }