public function storeRequest($request = null, $expiration = '+ 10 minutes'): string
    {
        // Both parameters are optional.
        if ($request === null) {
            $request = $this->getRequest();
        } elseif (!$request instanceof Request) {
            $expiration = $request;
            $request = $this->getRequest();
        }

        assert($request instanceof Request);
        $request = clone $request;
        $this->unloader->filterOut($request);

        $session = $this->getSession('Arachne.Application/requests');
        do {
            $key = Random::generate(5);
        } while (isset($session[$key]));

        $session[$key] = [$this->user !== null ? $this->user->getId() : null, $request];
        $session->setExpiration($expiration, $key);

        return $key;
    }