code: protected function saveToolStates()
      {
          $toolStateParameter = 'toolStates';
          if ($this->hasRequestParameter($toolStateParameter)) {
              // since the parameter content is a JSON string
              // we need to load it using the raw mode
              $param = $this->getRawRequestParameter($toolStateParameter);
              if ($param) {
                  $toolStates = json_decode($param, true);
  
                  if (count($toolStates) > 0) {
                      array_walk($toolStates, function (&$toolState) {
                          $toolState = json_encode($toolState);
                      });
                      $this->getRunnerService()->setToolsStates(
                          $this->getServiceContext(),
                          $toolStates
                      );
                      return true;
                  }
              }
          }
          return false;
      }
docs: Save the tool state if some are found in the current request
  
  @throws \oat\oatbox\service\exception\InvalidServiceManagerException
  @throws \common_Exception
  
  @return boolean true if some state was found and saved