public static SendDynamicNotificationRequest ToServiceModel(this ContactUsForm contactUsForm, WorkContext workContext)
        {
            var retVal = new SendDynamicNotificationRequest
            {
                Language = workContext.CurrentLanguage.CultureName,
                StoreId  = workContext.CurrentStore.Id,
                Type     = contactUsForm.FormType,
                Fields   = contactUsForm.Contact.ToDictionary(x => x.Key, x => x.Value != null ? x.Value.ToString() : string.Empty)
            };

            return(retVal);
        }
        public async Task <IActionResult> SendDynamicNotificationAnStoreEmail(SendDynamicNotificationRequest request)
        {
            var store = await _storeService.GetByIdAsync(request.StoreId);

            if (store == null)
            {
                throw new InvalidOperationException(string.Concat("Store not found. StoreId: ", request.StoreId));
            }

            if (string.IsNullOrEmpty(store.Email) && string.IsNullOrEmpty(store.AdminEmail))
            {
                throw new InvalidOperationException(string.Concat("Both store email and admin email are empty. StoreId: ", request.StoreId));
            }

            var notification = new StoreDynamicEmailNotification()
            {
                FormType = request.Type,
                Fields   = request.Fields
            };
            await _notificationSender.SendNotificationAsync(notification, request.Language);

            return(Ok());
        }