private async Task UpdateActiveTicketId(
            ulong userId,
            long actionId,
            CancellationToken cancellationToken)
        {
            AuthenticationLogMessages.AuthenticationTicketInvalidating(_logger, userId, actionId);

            using var transactionScope = _transactionScopeFactory.CreateScope();
            TransactionsLogMessages.TransactionScopeCreated(_logger);

            AuthenticationLogMessages.AuthenticationTicketActiveIdFetching(_logger, userId);
            var activeTicketIdResult = await _authenticationTicketsRepository.ReadActiveIdAsync(userId, cancellationToken);

            if (activeTicketIdResult.IsSuccess)
            {
                AuthenticationLogMessages.AuthenticationTicketActiveIdFetched(_logger, activeTicketIdResult.Value);
                AuthenticationLogMessages.AuthenticationTicketDeleting(_logger, userId, activeTicketIdResult.Value);
                await _authenticationTicketsRepository.DeleteAsync(
                    activeTicketIdResult.Value,
                    actionId,
                    cancellationToken);

                AuthenticationLogMessages.AuthenticationTicketDeleted(_logger, userId, activeTicketIdResult.Value);
            }
            else
            {
                AuthenticationLogMessages.AuthenticationTicketActiveIdFetched(_logger, null);
            }

            AuthenticationLogMessages.AuthenticationTicketCreating(_logger, userId);
            var newTicketId = await _authenticationTicketsRepository.CreateAsync(
                userId,
                actionId,
                cancellationToken);

            AuthenticationLogMessages.AuthenticationTicketCreated(_logger, userId, newTicketId);

            _memoryCache.Set(MakeUserActiveTicketIdCacheKey(userId), newTicketId);

            TransactionsLogMessages.TransactionScopeCommitting(_logger);
            transactionScope.Complete();

            AuthenticationLogMessages.AuthenticationTicketInvalidated(_logger, userId, newTicketId);
        }