@Override
    public String removeLecturer(String staffNum) {
        if (lookupLecturer(staffNum) == null) {
            return "Lecturer not found!\n";
        }
        lecturerEntity = em.find(LecturerEntity.class, lookupLecturer(staffNum).getId());
        List<ModuleEntity> currModules;
        Query q = em.createQuery("SELECT m FROM Module m");
        currModules = q.getResultList();
        if (currModules.isEmpty()) {
            em.remove(lecturerEntity);
            em.flush();
            em.clear();
            return "Lecturer is successfully deleted\n";
        } else {
            for (ModuleEntity currMod : currModules) {
                if (currMod.getLecturer().getStaffNumber().equals(staffNum)) {
                    em.clear();
                    return "Lecturer is associated with a module, cannot be deleted!\n";
                }
            }
            em.merge(lecturerEntity);
            em.remove(lecturerEntity);
            em.flush();
            em.clear();
            return "Lecturer is successfully deleted\n";
        }
    }