public virtual async Task <IActionResult> SubscribePopupPOST(int productId)
        {
            var product = await _productService.GetProductByIdAsync(productId);

            if (product == null || product.Deleted)
            {
                throw new ArgumentException("No product found with the specified id");
            }

            if (!await _customerService.IsRegisteredAsync(await _workContext.GetCurrentCustomerAsync()))
            {
                return(Content(await _localizationService.GetResourceAsync("BackInStockSubscriptions.OnlyRegistered")));
            }

            if (product.ManageInventoryMethod == ManageInventoryMethod.ManageStock &&
                product.BackorderMode == BackorderMode.NoBackorders &&
                product.AllowBackInStockSubscriptions &&
                await _productService.GetTotalStockQuantityAsync(product) <= 0)
            {
                //out of stock
                var subscription = await _backInStockSubscriptionService
                                   .FindSubscriptionAsync((await _workContext.GetCurrentCustomerAsync()).Id, product.Id, (await _storeContext.GetCurrentStoreAsync()).Id);

                if (subscription != null)
                {
                    //subscription already exists
                    //unsubscribe
                    await _backInStockSubscriptionService.DeleteSubscriptionAsync(subscription);

                    _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("BackInStockSubscriptions.Notification.Unsubscribed"));
                    return(new OkResult());
                }

                //subscription does not exist
                //subscribe
                if ((await _backInStockSubscriptionService
                     .GetAllSubscriptionsByCustomerIdAsync((await _workContext.GetCurrentCustomerAsync()).Id, (await _storeContext.GetCurrentStoreAsync()).Id, 0, 1))
                    .TotalCount >= _catalogSettings.MaximumBackInStockSubscriptions)
                {
                    return(Json(new
                    {
                        result = string.Format(await _localizationService.GetResourceAsync("BackInStockSubscriptions.MaxSubscriptions"), _catalogSettings.MaximumBackInStockSubscriptions)
                    }));
                }
                subscription = new BackInStockSubscription
                {
                    CustomerId   = (await _workContext.GetCurrentCustomerAsync()).Id,
                    ProductId    = product.Id,
                    StoreId      = (await _storeContext.GetCurrentStoreAsync()).Id,
                    CreatedOnUtc = DateTime.UtcNow
                };
                await _backInStockSubscriptionService.InsertSubscriptionAsync(subscription);

                _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("BackInStockSubscriptions.Notification.Subscribed"));
                return(new OkResult());
            }

            //subscription not possible
            return(Content(await _localizationService.GetResourceAsync("BackInStockSubscriptions.NotAllowed")));
        }