private async Task ProcessMessagesAsync(Message message, CancellationToken cancellationToken)
        {
            try
            {
                var messageBody = Encoding.UTF8.GetString(message.Body);
                _logger.LogDebug($"Received message: SequenceNumber: {message.SystemProperties.SequenceNumber} Body: {messageBody}");

                var user = System.Text.Json.JsonSerializer.Deserialize <AzureActiveDirectoryUser>(messageBody);
                await _messageProcessor.ProcessUser(user);

                if (!cancellationToken.IsCancellationRequested && !_subscriptionClient.IsClosedOrClosing && message.SystemProperties.IsLockTokenSet)
                {
                    await _subscriptionClient.CompleteAsync(message.SystemProperties.LockToken);
                }
            }
            catch (Exception ex)
            {
                var msg = $"Exception when processing message: {Encoding.UTF8.GetString(message.Body)}, sending message to DeadLetter. StackTrace: {ex.StackTrace}";
                _logger.LogError(ex, msg);

                if (!_subscriptionClient.IsClosedOrClosing && message.SystemProperties.IsLockTokenSet)
                {
                    await _subscriptionClient.DeadLetterAsync(message.SystemProperties.LockToken, msg);
                }
            }
        }