public virtual IActionResult Edit(WidgetAppModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }
            var widgetApp = _widgetAppService.GetWidgetAppById(model.Id);

            if (widgetApp == null)
            {
                return(RedirectToAction("List"));
            }
            widgetApp = model.ToEntity(widgetApp);
            _widgetAppService.UpdateWidgetApp(widgetApp);

            return(RedirectToAction("Edit", new { id = widgetApp.Id }));
        }
        public virtual IActionResult Create(WidgetAppModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageSettings))
            {
                return(AccessDeniedView());
            }

            var widgetApp = model.ToEntity <WidgetApp>();

            _widgetAppService.InsertWidgetApp(widgetApp);

            _customerActivityService.InsertActivity("AddNewWidgetApp",
                                                    string.Format(_localizationService.GetResource("ActivityLog.AddNewWidgetApp"), widgetApp.Id),
                                                    widgetApp);

            SuccessNotification(_localizationService.GetResource("Admin.WidgetApps.WidgetApp.Added"));

            model = _widgetAppModelFactory.PrepareWidgetAppModel(model, null);

            return(View(model));
        }