/// <summary>
        /// Sets the additional receiver information.
        /// </summary>
        /// <returns>Task.</returns>
        private async Task SetAdditionalReceiverInfo()
        {
            // Get information about the topic/queue for the receiver.
            if (ReceiverInfo.EntityType == EntityType.Topic)
            {
                if (ReceiverInfo.CreateEntityIfNotExists)
                {
                    await Task.Run(() => ManagerClient.CreateTopicIfNotExists(ReceiverInfo.EntityName, ReceiverInfo.EntitySubscriptionName, ReceiverInfo.EntityFilter));
                }

                var topic = await ManagerClient.GetTopicAsync(ReceiverInfo.EntityName);

                var subscription = await ManagerClient.GetSubscriptionAsync(ReceiverInfo.EntityName, ReceiverInfo.EntitySubscriptionName);

                ReceiverInfo.MaxEntitySizeMb = topic.MaxSizeInMB;
                ReceiverInfo.MaxLockDuration = subscription.LockDuration;
            }
            else
            {
                if (ReceiverInfo.CreateEntityIfNotExists)
                {
                    await Task.Run(() => ManagerClient.CreateQueueIfNotExists(ReceiverInfo.EntityName));
                }

                var queue = await ManagerClient.GetQueueAsync(ReceiverInfo.EntityName);

                ReceiverInfo.MaxLockDuration = queue.LockDuration;
                ReceiverInfo.MaxEntitySizeMb = queue.MaxSizeInMB;
            }
        }
        /// <summary>
        /// Sets the additional sender information.
        /// </summary>
        /// <returns>Task.</returns>
        private async Task SetAdditionalSenderInfo()
        {
            // Get information about the topic/queue for the sender.
            if (SenderInfo.EntityType == EntityType.Topic)
            {
                if (SenderInfo.CreateEntityIfNotExists)
                {
                    await Task.Run(() => ManagerClient.CreateTopicIfNotExists(SenderInfo.EntityName));
                }

                var queue = await ManagerClient.GetTopicAsync(SenderInfo.EntityName);

                SenderInfo.MaxEntitySizeMb = queue.MaxSizeInMB;
            }
            else
            {
                if (SenderInfo.CreateEntityIfNotExists)
                {
                    await Task.Run(() => ManagerClient.CreateQueueIfNotExists(SenderInfo.EntityName));
                }

                var queue = await ManagerClient.GetQueueAsync(SenderInfo.EntityName);

                SenderInfo.MaxEntitySizeMb = queue.MaxSizeInMB;
            }

            SenderInfo.MaxMessageBatchSizeBytes = IsPremiumTier ? 1024000 : 256000;
        }
        /// <summary>
        /// Creates a new Queue, Topic and or Subscription.
        /// </summary>
        /// <param name="config">The config with the creation details, <see cref="ServiceBusEntityConfig"/>.</param>
        /// <exception cref="NullReferenceException"></exception>
        public async Task CreateEntity(IEntityConfig config)
        {
            if (!(config is ServiceBusEntityConfig sbConfig))
            {
                throw new InvalidOperationException("ServiceBusCreateEntityConfig is required ");
            }

            if (sbConfig.EntityType == EntityType.Topic)
            {
                await Task.Run(() => ManagerClient.CreateTopicIfNotExists(sbConfig.EntityName, sbConfig.EntitySubscriptionName, sbConfig.SqlFilter));
            }
            else
            {
                await Task.Run(() => ManagerClient.CreateQueueIfNotExists(sbConfig.EntityName));
            }
        }