public virtual IActionResult ProductEmailAFriendSend(ProductEmailAFriendModel model, bool captchaValid)
        {
            var product = _productService.GetProductById(model.ProductId);

            if (product == null || !product.Published || !_catalogSettings.EmailAFriendEnabled)
            {
                return(RedirectToRoute("HomePage"));
            }

            //validate CAPTCHA
            if (_captchaSettings.Enabled && _captchaSettings.ShowOnEmailProductToFriendPage && !captchaValid)
            {
                ModelState.AddModelError("", _captchaSettings.GetWrongCaptchaMessage(_localizationService));
            }

            //check whether the current customer is guest and ia allowed to email a friend
            if (_workContext.CurrentCustomer.IsGuest() && !_catalogSettings.AllowAnonymousUsersToEmailAFriend)
            {
                ModelState.AddModelError("", _localizationService.GetResource("Products.EmailAFriend.OnlyRegisteredUsers"));
            }

            if (ModelState.IsValid)
            {
                //email
                _productWebService.SendProductEmailAFriendMessage(product, model);

                model.ProductId     = product.Id;
                model.ProductName   = product.GetLocalized(x => x.Name);
                model.ProductSeName = product.GetSeName();

                model.SuccessfullySent = true;
                model.Result           = _localizationService.GetResource("Products.EmailAFriend.SuccessfullySent");

                return(View(model));
            }

            //If we got this far, something failed, redisplay form
            model.ProductId      = product.Id;
            model.ProductName    = product.GetLocalized(x => x.Name);
            model.ProductSeName  = product.GetSeName();
            model.DisplayCaptcha = _captchaSettings.Enabled && _captchaSettings.ShowOnEmailProductToFriendPage;
            return(View(model));
        }