private static void saveContentReference(VirtualFile file, int contentId) {
    if (contentId == 0) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("saveContentReference without content for file = " + file);
      }
      return; // content not loaded yet, nothing to save
    }

    LOG.assertTrue(contentId > 0, contentId);

    if (LOG.isDebugEnabled()) {
      LOG.debug("saveContentReference file = " + file + ", id = " + contentId);
    }

    long stamp = file.getTimeStamp();
    try {
      try (DataOutputStream contentStream = ACQUIRED_CONTENT_ATTR.writeFileAttribute(file)) {
        contentStream.writeInt(contentId);
      }

      try (DataOutputStream tsStream = LAST_TS_ATTR.writeFileAttribute(file)) {
        tsStream.writeLong(stamp);
      }

      file.putUserData(LAST_TS_KEY, stamp);
    }
    catch (IOException e) {
      LOG.info(e);
    }
  }
private static void saveContentReference(VirtualFile file, int contentId)