protected function prepareData(RequestInterface $request, User $user)
    {
        $userId = $user->getIdentifier();
        if ($userId === null) {
            $userId = get_class($user);
        }

        return [
            RequestLogService::USER_ID => $userId,
            RequestLogService::USER_ROLES => ','. implode(',', $user->getRoles()). ',',
            RequestLogService::ACTION => $request->getUri()->getPath(),
            RequestLogService::EVENT_TIME => microtime(true),
            RequestLogService::DETAILS => json_encode([
                'method' => $request->getMethod(),
                'query' => $request->getUri()->getQuery(),
            ]),
        ];
    }