public async Task AddSubscriber(SubscriptionSettings subscriptionSettings)
        {
            CloudTable table = await this.GetTable();

            SubscriptionEntity entity = SubscriptionMapper.FromSettings(subscriptionSettings);

            string filter = TableQuery.CombineFilters(
                TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, subscriptionSettings.SubscriptionName.ToString()),
                TableOperators.And,
                TableQuery.GenerateFilterCondition(nameof(SubscriptionEntity.WebhookUrl), QueryComparisons.Equal, subscriptionSettings.WebhookUrl)
                );

            TableQuerySegment <SubscriptionEntity> existingHookQueryResult = await table.ExecuteQuerySegmentedAsync(new TableQuery <SubscriptionEntity>().Where(filter), null);

            if (existingHookQueryResult.Results.Any())
            {
                throw new InvalidOperationException("Specified webhook is already registered for this comic subscription.");
            }

            TableOperation insertOrMergeOperation = TableOperation.InsertOrMerge(entity);
            TableResult    result = await table.ExecuteAsync(insertOrMergeOperation);

            SubscriptionEntity inserted = result.Result as SubscriptionEntity;

            if (result.HttpStatusCode != 204)
            {
                throw new InvalidOperationException($"Failed to insert subscriber. Response: {result.HttpStatusCode}");
            }
        }
        public static SubscriptionEntity FromSettings(SubscriptionSettings subscriptionSettings)
        {
            SubscriptionEntity entity = new SubscriptionEntity
            {
                PartitionKey        = subscriptionSettings.SubscriptionName.ToString(),
                RowKey              = subscriptionSettings.SubscriptionId,
                WebhookUrl          = subscriptionSettings.WebhookUrl,
                IntegrationPlatform = subscriptionSettings.IntegrationPlatform.ToString()
            };

            return(entity);
        }
        public static SubscriptionSettings FromEntity(SubscriptionEntity entity)
        {
            SubscriptionSettings settings = new SubscriptionSettings()
            {
                SubscriptionName    = Enum.Parse <SubscriptionName>(entity.PartitionKey),
                SubscriptionId      = entity.RowKey,
                WebhookUrl          = entity.WebhookUrl,
                IntegrationPlatform = Enum.Parse <IntegrationPlatform>(entity.IntegrationPlatform),
            };

            return(settings);
        }