private void updateIndex() {
    Collections.sort(index, comparator);
    DataOutput dataOutput = new DataOutput();
    dataOutput.writeInt(index.size());

    for (Index i : index) {
      dataOutput.writeLong(i.getId());
      dataOutput.writeLong(i.getSortKey());
    }

    storage.setItem("list_" + prefix + "_index", toBase64(dataOutput.toByteArray()));
  }
  @Override
  public ListEngineRecord loadItem(long key) {
    Index indexValue = null;
    for (Index i : index) {
      if (i.getId() == key) {
        indexValue = i;
        break;
      }
    }

    if (indexValue == null) {
      return null;
    }

    String item = storage.getItem(getId(key));
    if (item != null) {
      byte[] res = fromBase64(item);
      return new ListEngineRecord(key, indexValue.getSortKey(), null, res);
    }
    return null;
  }
 @Override
 public int compare(Index o1, Index o2) {
   return -compare(o1.getSortKey(), o2.getSortKey());
 }