public static Task EnqueueAsync(
            this IManagedMqttClient managedMqttClient,
            string topic,
            string payload = null,
            MqttQualityOfServiceLevel qualityOfServiceLevel = MqttQualityOfServiceLevel.AtMostOnce,
            bool retain = false)
        {
            if (managedMqttClient == null)
            {
                throw new ArgumentNullException(nameof(managedMqttClient));
            }

            if (topic == null)
            {
                throw new ArgumentNullException(nameof(topic));
            }

            var applicationMessage = new MqttApplicationMessageBuilder().WithTopic(topic)
                                     .WithPayload(payload)
                                     .WithRetainFlag(retain)
                                     .WithQualityOfServiceLevel(qualityOfServiceLevel)
                                     .Build();

            return(managedMqttClient.EnqueueAsync(applicationMessage));
        }