code: public function prepare($value)
      {
          /** @var Importer $importer */
          $importer = $this->getVariably()->get('importer');
          $table = $importer->getCurrentTable();
  
          if (!isset($this->counter[$table])) {
              $db = $importer->getDb();
              $counter = $db->fetchOne('SELECT MAX(DISTINCT counter) AS counter FROM ' . $table);
  
              $this->counter[$table] = $counter['counter'] + 1;
          }
  
          return $this->counter[$table];
      }
docs: This method check existing counter and if it isn`t exist it calculate a new one.
  
  @param $value
  @return mixed