@Override
    public String removeModule(String modCode) {
        if (lookupModuleFromCode(modCode) == null) {
            return "Module not found!\n";
        }
        moduleEntity = em.find(ModuleEntity.class, lookupModuleFromCode(modCode).getId());
        Set<StudentEntity> currStudents = moduleEntity.getStudents();
        if (!currStudents.isEmpty()) {
            return "Module has registered students, cannot be deleted!\n";
        }
        Collection<TutorialEntity> currentTutorials = moduleEntity.getTutorials();
        for (TutorialEntity tutorial : currentTutorials) {
            if (!tutorial.getStudents().isEmpty()) {
                return "Module has an associated tutorial with registered students, cannot be deleted!\n";
            }
        }
        em.remove(moduleEntity);
        em.flush();
        em.clear();
        return "Module is successfully deleted!\n";
    }