private async Task LogMessage(MqttConnectionValidatorContext context, bool newConnection = false,
                                      bool showPassword = false)
        {
            if (context == null)
            {
                return;
            }

            if (newConnection)
            {
                var connection = new Connection
                {
                    ClientId     = context.ClientId,
                    CleanSession = context.CleanSession,
                    Endpoint     = context.Endpoint,
                    Password     = context.Password,
                    Username     = context.Username
                };
                _repo.AddConnection(connection);
                await _repo.SaveChangesAsync();
            }

            if (showPassword)
            {
                _logger.LogInformation(
                    $"New connection: ClientId = {context.ClientId}, Endpoint = {context.Endpoint},"
                    + $" Username = {context.Username}, Password = {context.Password},"
                    + $" CleanSession = {context.CleanSession}");
            }
            else
            {
                _logger.LogInformation(
                    $"New connection: ClientId = {context.ClientId}, Endpoint = {context.Endpoint},"
                    + $" Username = {context.Username}, CleanSession = {context.CleanSession}");
            }
        }