/**
  * Overwrites default response method on FormRequest class. The only change is that
  * JSON response have custom structure.
  *
  * @param array $errors
  *
  * @return $this|JsonResponse
  */
 public function response(array $errors)
 {
     if ($this->ajax() || $this->wantsJson()) {
         $response = new ResponseBuilder(new JsonResponse());
         return $response->error(ResponseCode::UNPROCESSABLE_ENTITY, $errors);
     }
     return $this->redirector->to($this->getRedirectUrl())->withInput($this->except($this->dontFlash))->withErrors($errors, $this->errorBag);
 }