code: public function submitReview($record, $data)
      {
          /** @var DataObject|SiteTreeContentReview $record */
          if (!$this->canSubmitReview($record)) {
              throw new ValidationException(_t(
                  __CLASS__ . '.ErrorReviewPermissionDenied',
                  'It seems you don\'t have the necessary permissions to submit a content review'
              ));
          }
  
          $notes = (!empty($data['Review']) ? $data['Review'] : _t(__CLASS__ . '.NoComments', '(no comments)'));
          $record->addReviewNote(Security::getCurrentUser(), $notes);
          $record->advanceReviewDate();
  
          $request = $this->controller->getRequest();
          $message = _t(__CLASS__ . '.Success', 'Review successfully added');
  
          if ($request->getHeader('X-Formschema-Request')) {
              return $message;
          } elseif (Director::is_ajax()) {
              $response = HTTPResponse::create($message, 200);
              $response->addHeader('Content-Type', 'text/html; charset=utf-8');
              return $response;
          }
  
          return $this->controller->redirectBack();
      }
docs: Validate, and save the submitted form's review
  
  @param  DataObject $record
  @param  array $data
  @return HTTPResponse|string
  @throws ValidationException If the user cannot submit the review