public static function createFromException(Exception $exception, Request $request) {
        $date = new DateTime('now', new DateTimeZone('UTC'));

        $model = new self();
        $model->setHttpCode($exception->getCode())
              ->setErrorMessage($exception->getMessage())
              ->setDate($date)
              ->setImboErrorCode($exception->getImboErrorCode() ?: Exception::ERR_UNSPECIFIED);

        if ($image = $request->getImage()) {
            $model->setImageIdentifier($image->getImageIdentifier());
        } else if ($identifier = $request->getImageIdentifier()) {
            $model->setImageIdentifier($identifier);
        }

        return $model;
    }