private void markAsDeletedRecursively(int fileId) throws IOException {
    IntList ids = new IntArrayList();
    ids.add(fileId);
    for (int i = 0; i < ids.size(); i++) {
      int id = ids.getInt(i);
      //FiXME RC: what if id is already deleted -> listIds(id) fails with 'attribute already deleted'?
      ids.addElements(ids.size(), listIds(id));
    }
    PersistentFSRecordsStorage records = connection.getRecords();
    InvertedNameIndex invertedNameIndex = invertedNameIndexLazy.get();
    // delete children first:
    for (int i = ids.size() - 1; i >= 0; i--) {
      int id = ids.getInt(i);
      int nameId = records.getNameId(id);
      int flags = records.getFlags(id);

      if (PersistentFS.isDirectory(flags)) {
        treeAccessor.deleteDirectoryRecord(id);
      }
      recordAccessor.markRecordAsDeleted(id);

      invertedNameIndex.updateFileName(id, NULL_NAME_ID, nameId);
    }
    invertedNameIndexModCount.incrementAndGet();
  }
private void markAsDeletedRecursively(int fileId)