public static SyncFile updateFolderSyncFile(Path filePath, long syncAccountId, SyncFile syncFile)
      throws Exception {

    // Local sync file

    updateSyncFile(filePath, syncFile.getParentFolderId(), syncFile);

    // Remote sync file

    if ((syncFile.getState() != SyncFile.STATE_ERROR)
        && (syncFile.getState() != SyncFile.STATE_UNSYNCED)) {

      FileEventUtil.updateFolder(filePath, syncAccountId, syncFile);
    }

    return syncFile;
  }