@Override
    public boolean check(UserContext user, Department source) {
      if (!permissionDepartment.check(user, source)) return false;

      if (!source.isAllowEvents()) return false;

      int nrRooms =
          ((Number)
                  DepartmentDAO.getInstance()
                      .getSession()
                      .createQuery(
                          "select count(r) from Room r "
                              + "where r.eventDepartment.uniqueId=:deptId")
                      .setLong("deptId", source.getUniqueId())
                      .setCacheable(true)
                      .uniqueResult())
              .intValue();

      if (nrRooms > 0) return true;

      int nrLocations =
          ((Number)
                  DepartmentDAO.getInstance()
                      .getSession()
                      .createQuery(
                          "select count(r) from NonUniversityLocation r "
                              + "where r.eventDepartment.uniqueId=:deptId")
                      .setLong("deptId", source.getUniqueId())
                      .setCacheable(true)
                      .uniqueResult())
              .intValue();

      return nrLocations > 0;
    }
    @Override
    public boolean check(UserContext user, Department source) {
      if (!permissionDepartment.check(user, source)) return false;

      return source.isAllowEvents() && !Roles.findAllInstructorRoles().isEmpty();
    }