public IActionResult SubscriptionOperation(Guid subscriptionId, string planId, string operation, int NumberofProviders)
        {
            this.logger.LogInformation("Home Controller / SubscriptionOperation subscriptionId:{0} :: planId : {1} :: operation:{2} :: NumberofProviders : {3}", JsonConvert.SerializeObject(subscriptionId), JsonConvert.SerializeObject(planId), JsonConvert.SerializeObject(operation), JsonConvert.SerializeObject(NumberofProviders));
            try
            {
                bool isSuccess = false;
                if (subscriptionId != default)
                {
                    SubscriptionResult subscriptionDetail = new SubscriptionResult();
                    this.logger.LogInformation("GetPartnerSubscription");
                    var oldValue = this.webSubscriptionService.GetSubscriptionsByScheduleId(subscriptionId);
                    this.logger.LogInformation("GetUserIdFromEmailAddress");
                    var currentUserId = userService.GetUserIdFromEmailAddress(this.CurrentUserEmailAddress);

                    if (operation == "Activate")
                    {
                        var response = this.fulfillApiClient.ActivateSubscriptionAsync(subscriptionId, planId).ConfigureAwait(false).GetAwaiter().GetResult();
                        this.webSubscriptionService.UpdateStateOfSubscription(subscriptionId, SubscriptionStatusEnum.Subscribed, true);

                        isSuccess = true;
                        this.logger.LogInformation("GetPartnerSubscription");
                        this.logger.LogInformation("GetAllSubscriptionPlans");
                        subscriptionDetail          = this.webSubscriptionService.GetSubscriptionsByScheduleId(subscriptionId);
                        subscriptionDetail.PlanList = this.webSubscriptionService.GetAllSubscriptionPlans();
                        var  subscriptionData = this.fulfillApiClient.GetSubscriptionByIdAsync(subscriptionId).ConfigureAwait(false).GetAwaiter().GetResult();
                        bool checkIsActive    = emailTemplateRepository.GetIsActive(subscriptionDetail.SaasSubscriptionStatus.ToString()).HasValue ? emailTemplateRepository.GetIsActive(subscriptionDetail.SaasSubscriptionStatus.ToString()).Value : false;
                        this.logger.LogInformation("sendEmail");
                        if (Convert.ToBoolean(applicationConfigRepository.GetValuefromApplicationConfig(EmailTriggerConfigurationConstants.ISEMAILENABLEDFORSUBSCRIPTIONACTIVATION)) == true)
                        {
                            EmailHelper.SendEmail(subscriptionDetail, applicationConfigRepository, emailTemplateRepository);
                        }
                    }

                    if (operation == "Deactivate")
                    {
                        try
                        {
                            this.logger.LogInformation("operation == Deactivate");
                            this.logger.LogInformation("DeleteSubscriptionAsync");
                            var response = this.fulfillApiClient.DeleteSubscriptionAsync(subscriptionId, planId).ConfigureAwait(false).GetAwaiter().GetResult();
                            this.logger.LogInformation("UpdateStateOfSubscription");
                            this.webSubscriptionService.UpdateStateOfSubscription(subscriptionId, SubscriptionStatusEnum.Unsubscribed, false);
                            subscriptionDetail = this.webSubscriptionService.GetSubscriptionsByScheduleId(subscriptionId, true);
                            subscriptionDetail.SaasSubscriptionStatus = SubscriptionStatusEnum.Unsubscribed;
                            isSuccess = true;
                            this.logger.LogInformation("GetIsActive");
                            bool checkIsActive = emailTemplateRepository.GetIsActive(subscriptionDetail.SaasSubscriptionStatus.ToString()).HasValue ? emailTemplateRepository.GetIsActive(subscriptionDetail.SaasSubscriptionStatus.ToString()).Value : false;

                            if (Convert.ToBoolean(applicationConfigRepository.GetValuefromApplicationConfig(EmailTriggerConfigurationConstants.ISEMAILENABLEDFORUNSUBSCRIPTION)) == true)
                            {
                                this.logger.LogInformation("SendEmail to {0} :: Template{1} ", JsonConvert.SerializeObject(applicationConfigRepository), JsonConvert.SerializeObject(emailTemplateRepository));

                                EmailHelper.SendEmail(subscriptionDetail, applicationConfigRepository, emailTemplateRepository);
                            }
                        }
                        catch (FulfillmentException fex)
                        {
                            this.logger.LogError($"Deactive Subscription plan Error - {fex.Message} with StackTrace- {fex.StackTrace}.");
                            this.TempData["ErrorMsg"] = fex.Message;
                        }
                    }

                    var newValue = this.webSubscriptionService.GetSubscriptionsByScheduleId(subscriptionId, true);
                    if (isSuccess)
                    {
                        if (oldValue != null && newValue != null)
                        {
                            SubscriptionAuditLogs auditLog = new SubscriptionAuditLogs()
                            {
                                Attribute      = Convert.ToString(SubscriptionLogAttributes.Status),
                                SubscriptionId = newValue.SubscribeId,
                                NewValue       = Convert.ToString(newValue.SaasSubscriptionStatus),
                                OldValue       = Convert.ToString(oldValue.SaasSubscriptionStatus),
                                CreateBy       = currentUserId,
                                CreateDate     = DateTime.Now
                            };
                            this.subscriptionLogRepository.Add(auditLog);

                            //auditLog = new SubscriptionAuditLogs()
                            //{
                            //    Attribute = Convert.ToString(SubscriptionLogAttributes.ProviderCount),
                            //    SubscriptionId = newValue.SubscribeId,
                            //    NewValue = Convert.ToString(newValue.NumberofProviders),
                            //    OldValue = Convert.ToString(oldValue.NumberofProviders),
                            //    CreateBy = currentUserId,
                            //    CreateDate = DateTime.Now
                            //};
                            //this.subscriptionLogRepository.Add(auditLog);
                        }
                    }
                }
                return(this.RedirectToAction(nameof(this.ActivatedMessage)));
            }
            catch (Exception ex)
            {
                this.logger.LogInformation("Message:{0} :: {1}", ex.Message, ex.InnerException);
                return(View("Error"));
            }
        }