code: long getNewToplevelCorpusID(Offsets offsets)
    {
      log.info("query for the new corpus ID");
  
      long maxLocalID = getJdbcTemplate().queryForObject(
        "SELECT MAX(id) FROM _corpus WHERE top_level IS TRUE", Long.class);
  
      long result = maxLocalID + offsets.getCorpusID();
  
      log.info("new corpus ID is " + result);
      return result;
    }
docs: /*
  private long getRecentCorpusID()
  {
  int numOfEntries = getJdbcTemplate().queryForObject(
  "SELECT COUNT(*) from corpus_stats", Integer.class);
  
  long recentCorpusId = 0;
  
  if (numOfEntries > 0)
  {
  recentCorpusId = getJdbcTemplate().queryForObject(
  "SELECT max(id) FROM corpus_stats", Long.class);
  log.debug("the id from recently imported corpus: {}", recentCorpusId);
  }
  return recentCorpusId;
  }