/// <inheritdoc/>
        public async Task ProcessOperationFailOrConflictAsync(
            WebhookPayload payload,
            CancellationToken cancellationToken = default)
        {
            if (payload == null)
            {
                throw new ArgumentNullException(nameof(payload));
            }

            var notificationModel = NotificationModel.FromWebhookPayload(payload);

            var queryParams = new List <Tuple <string, string> >
            {
                new Tuple <string, string>(
                    "subscriptionId",
                    notificationModel.SubscriptionId.ToString()),
            };

            var subscriptionDetails = await this.marketplaceClient.FulfillmentOperations.GetSubscriptionAsync(
                notificationModel.SubscriptionId,
                Guid.Empty,
                Guid.Empty,
                cancellationToken).ConfigureAwait(false);

            await this.SendEmailAsync(
                () => $"Operation failure, {subscriptionDetails.Name}",
                () =>
                $"<p>Operation failure. {this.BuildALink("Operations", queryParams, "Click here to list all operations for this subscription", "Subscriptions")}</p>. "
                + $"<p> Details are {BuildTable(JObject.Parse(JsonConvert.SerializeObject(subscriptionDetails)))}</p>",
                cancellationToken).ConfigureAwait(false);
        }
        private async Task SendWebhookNotificationEmailAsync(
            string subject,
            string mailBody,
            string actionName,
            WebhookPayload payload,
            CancellationToken cancellationToken)
        {
            if (payload == null)
            {
                throw new ArgumentNullException(nameof(payload));
            }

            var notificationModel = NotificationModel.FromWebhookPayload(payload);

            if (string.IsNullOrEmpty(actionName))
            {
                var queryParams = new List <Tuple <string, string> >
                {
                    new Tuple <string, string>(
                        "subscriptionId",
                        notificationModel.SubscriptionId.ToString()),
                    new Tuple <string, string>("publisherId", notificationModel.PublisherId),
                    new Tuple <string, string>("offerId", notificationModel.OfferId),
                    new Tuple <string, string>("planId", notificationModel.PlanId),
                    new Tuple <string, string>("quantity", notificationModel.Quantity.ToString(CultureInfo.InvariantCulture)),
                    new Tuple <string, string>("operationId", notificationModel.OperationId.ToString()),
                };

                var actionLink = !string.IsNullOrEmpty(actionName)
                    ? this.BuildALink(actionName, queryParams, "Click here to confirm.")
                    : string.Empty;

                mailBody = $"{mailBody}" + $"{actionLink}";
            }

            var subscriptionDetails = await this.marketplaceClient.FulfillmentOperations.GetSubscriptionAsync(
                notificationModel.SubscriptionId,
                Guid.Empty,
                Guid.Empty,
                cancellationToken).ConfigureAwait(false);

            await this.SendEmailAsync(
                () => $"{subject}, {subscriptionDetails.Name}",
                () => $"<p>{mailBody}</p>"
                + $"<br/><div> Details are {BuildTable(JObject.Parse(JsonConvert.SerializeObject(subscriptionDetails)))}</div>",
                cancellationToken).ConfigureAwait(false);
        }