@Override
  public Boolean execute(OnlineSectioningServer server, OnlineSectioningHelper helper) {
    for (Long offeringId : getOfferingIds()) {
      helper
          .getAction()
          .addOther(
              OnlineSectioningLog.Entity.newBuilder()
                  .setUniqueId(offeringId)
                  .setType(OnlineSectioningLog.Entity.EntityType.OFFERING));

      List<Long> studentIds =
          (List<Long>)
              helper
                  .getHibSession()
                  .createQuery(
                      "select distinct cr.courseDemand.student.uniqueId from CourseRequest cr "
                          + "where cr.courseOffering.instructionalOffering.uniqueId = :offeringId")
                  .setLong("offeringId", offeringId)
                  .list();
      studentIds.addAll(
          helper
              .getHibSession()
              .createQuery(
                  "select distinct e.student.uniqueId from StudentClassEnrollment e "
                      + "where e.courseOffering.instructionalOffering.uniqueId = :offeringId and e.courseRequest is null")
              .setLong("offeringId", offeringId)
              .list());
      /*
      List<Long> studentIds = (List<Long>)helper.getHibSession().createQuery(
      		"select distinct s.uniqueId from Student s " +
      		"left outer join s.classEnrollments e " +
      		"left outer join s.courseDemands d left outer join d.courseRequests r left outer join r.courseOffering co " +
      		"where e.courseOffering.instructionalOffering.uniqueId = :offeringId or " +
      		"co.instructionalOffering.uniqueId = :offeringId").setLong("offeringId", offeringId).list();
      */

      Lock lock = server.lockOffering(offeringId, studentIds, name());
      try {
        helper.beginTransaction();
        try {
          reloadOffering(server, helper, offeringId);

          helper.commitTransaction();
        } catch (Exception e) {
          helper.rollbackTransaction();
          if (e instanceof SectioningException) throw (SectioningException) e;
          throw new SectioningException(MSG.exceptionUnknown(e.getMessage()), e);
        }
      } finally {
        lock.release();
      }
    }
    return true;
  }