public ActionResult SaveDashboardFilter(EditDashboardViewModel viewModel)
        {
            if (!_authorizer.Authorize(Permissions.ConfigureUrlProtector, T("Not authorized to manage settings")))
            {
                return new HttpUnauthorizedResult();
            }

            //Validate the values for valid regex patterns if a value is supplied

            if (!String.IsNullOrEmpty(viewModel.DashboardFilterRecord.UserHostAddressPattern) && !IsValidRegex(viewModel.DashboardFilterRecord.UserHostAddressPattern))
            {
                ModelState.AddModelError(String.Empty, "Userhostaddress pattern is not a valid regex expression");
            }

            if (!String.IsNullOrEmpty(viewModel.DashboardFilterRecord.UserAgentPattern) && !IsValidRegex(viewModel.DashboardFilterRecord.UserAgentPattern))
            {
                ModelState.AddModelError(String.Empty, "Useragent pattern is not a valid regex expression");
            }

            if (!ModelState.IsValid)
            {
                return View("EditDashboard", viewModel);
            }

            _dashboardFilterRecords.Update(viewModel.DashboardFilterRecord);
            _orchardServices.Notifier.Add(NotifyType.Information, T("The dashboard filter has been saved"));
            _signals.Trigger(CachedUrlProtectorRules.SignalUpdateUrlFilterRecordsTrigger);

            return RedirectToAction("Show");
        }
        public ActionResult EditDashboard()
        {
            if (!_authorizer.Authorize(Permissions.ConfigureUrlProtector, T("Not authorized to manage settings")))
            {
                return new HttpUnauthorizedResult();
            }

            //Only one item for the dashboard (always id = 1)
            DashboardFilterRecord dashboardFilterRecord = _dashboardFilterRecords.Get(1);
            if (dashboardFilterRecord == null)
            {
                return new HttpNotFoundResult("Could not find the dashboard filter");
            }

            EditDashboardViewModel viewModel = new EditDashboardViewModel {DashboardFilterRecord = dashboardFilterRecord};
            return View("EditDashboard", viewModel);
        }