@Override
  public FeatureInterface execute(UpdateRoomFeatureRequest request, SessionContext context) {
    if (request.hasSessionId()) context = new EventContext(context, request.getSessionId());

    Transaction tx = null;
    RoomFeature f = null;
    try {
      org.hibernate.Session hibSession = new RoomDeptDAO().getSession();
      tx = hibSession.beginTransaction();

      if (request.hasFeature()) {

        if (request.hasFutureSessions())
          for (Long id : request.getFutureSessions())
            createOrUpdateFeature(
                request.getFeature(),
                request.getAddLocations(),
                request.getDropLocations(),
                id,
                hibSession,
                new EventContext(context, context.getUser(), id),
                true);
        f =
            createOrUpdateFeature(
                request.getFeature(),
                request.getAddLocations(),
                request.getDropLocations(),
                context.getUser().getCurrentAcademicSessionId(),
                hibSession,
                context,
                false);

      } else if (request.getDeleteFeatureId() != null) {

        if (request.hasFutureSessions())
          for (Long id : request.getFutureSessions())
            dropFeature(
                request.getDeleteFeatureId(),
                id,
                hibSession,
                new EventContext(context, context.getUser(), id),
                true);
        dropFeature(
            request.getDeleteFeatureId(),
            context.getUser().getCurrentAcademicSessionId(),
            hibSession,
            context,
            false);

      } else {
        throw new GwtRpcException("Bad request.");
      }

      FeatureInterface feature = null;
      if (f != null) {
        feature = new FeatureInterface(f.getUniqueId(), f.getAbbv(), f.getLabel());
        if (f.getFeatureType() != null)
          feature.setType(
              new FeatureTypeInterface(
                  f.getFeatureType().getUniqueId(),
                  f.getFeatureType().getReference(),
                  f.getFeatureType().getLabel(),
                  f.getFeatureType().isShowInEventManagement()));
        if (f instanceof DepartmentRoomFeature) {
          Department d = ((DepartmentRoomFeature) f).getDepartment();
          feature.setDepartment(RoomDetailsBackend.wrap(d, null, null));
          feature.setTitle(
              f.getLabel()
                  + " ("
                  + d.getName()
                  + (f.getFeatureType() == null ? "" : ", " + f.getFeatureType().getLabel())
                  + ")");
        } else {
          feature.setTitle(
              f.getLabel()
                  + (f.getFeatureType() == null ? "" : " (" + f.getFeatureType().getLabel() + ")"));
        }
      }

      tx.commit();

      return feature;
    } catch (Exception e) {
      e.printStackTrace();
      if (tx != null) tx.rollback();
      if (e instanceof GwtRpcException) throw (GwtRpcException) e;
      throw new GwtRpcException(e.getMessage());
    }
  }