/**
   * Move the asset class up in the sort order. Increase sort order for this item. Finds the next in
   * order and decrease it's sort order.
   */
  public void moveClassUp(int id) {
    // todo: this is incomplete. Need to set the default value on creation and handle
    // deletions. Also pay attention if the order will be ascending or descending and adjust.

    //        List<AssetClass> bulk = new ArrayList();

    AssetClass up = repository.load(id);
    Integer currentPosition = up.getSortOrder();
    if (currentPosition == null) currentPosition = 0;
    int upPosition = currentPosition + 1;

    up.setSortOrder(upPosition);
    //        bulk.add(up);

    //        WhereStatementGenerator where = new WhereStatementGenerator();
    //        String filter = where.getStatement(AssetClass.SORTORDER, "=", upPosition);
    //        AssetClass down = repository.first(filter);
    //        if (down != null) {
    //            down.setSortOrder(currentPosition);
    //            bulk.add(down);
    //        }
    //
    //        // save in transaction
    //        repository.bulkUpdate(bulk);

    // for now, just increase the sort order on the selected item
    repository.update(up);
  }
  public void moveClassDown(int id) {
    AssetClass assetClass = repository.load(id);
    Integer currentPosition = assetClass.getSortOrder();
    if (currentPosition == null) currentPosition = 0;
    int nextPosition = currentPosition - 1;
    if (nextPosition < 0) return;

    assetClass.setSortOrder(nextPosition);

    repository.update(assetClass);
  }