code: protected function insert($entity, $tableName = null, HydratorInterface $hydrator = null)
      {
          $result = parent::insert($entity, $tableName, $hydrator);
          $entity->setId($result->getGeneratedValue());
          return $result;
      }
docs: insert - Inserts a new thread into the database, using the specified hydrator.
  
  @param ThreadInterface $entity
  @param String $tableName
  @param HydratorInterface $hydrator
  @return unknown