public function prepareDownload(Request $request, Token $token)
    {
        if (false === $list = @unserialize($token->getData())) {
            $this->app->abort(500, 'Invalid datas');
        }

        if (!is_array($list)) {
            $this->app->abort(500, 'Invalid datas');
        }

        foreach (['export_name', 'files'] as $key) {
            if (!isset($list[$key])) {
                $this->app->abort(500, 'Invalid datas');
            }
        }

        $records = [];

        foreach ($list['files'] as $file) {
            if (!is_array($file) || !isset($file['base_id']) || !isset($file['record_id'])) {
                continue;
            }
            $sbasId = \phrasea::sbasFromBas($this->app, $file['base_id']);

            try {
                $record = new \record_adapter($this->app, $sbasId, $file['record_id']);
            } catch (\Exception $e) {
                continue;
            }

            $records[sprintf('%s_%s', $sbasId, $file['record_id'])] = $record;
        }

        return new Response($this->render(
            '/prod/actions/Download/prepare.html.twig', [
            'module_name'   => $this->app->trans('Export'),
            'module'        => $this->app->trans('Export'),
            'list'          => $list,
            'records'       => $records,
            'token'         => $token,
            'anonymous'     => $request->query->get('anonymous', false),
            'type'          => $request->query->get('type', \Session_Logger::EVENT_EXPORTDOWNLOAD)
        ]));
    }