code: protected function _beforeSave()
      {
          parent::_beforeSave();
  
          if (!$this->getId()) {
              $this->setToken($this->generateToken());
              $this->setHttpMethod($this->getController()->getHttpMethod());
              $this->setResponseCode($this->getController()->getResponseCode());
              $this->setIp($this->getController()->getRemoteIp());
          }
  
          $this->setRequestPath($this->getController()->getRequestOriginalPath());
          $this->setSessionId($this->getController()->getSessionId());
          $this->setInfo($this->getSerializedInfo());
  
          return $this;
      }
docs: Initialize persistent fields that are used as filters and prepare info blob
  
  @return $this