public override void OnActionExecuted(ActionExecutedContext filterContext)
        {
            BaseViewModel model;
            if (filterContext.Controller.ViewData.Model == null) {
                model = new BaseViewModel();
                filterContext.Controller.ViewData.Model = model;
            }
            else {
                model = filterContext.Controller.ViewData.Model as BaseViewModel;
            }
            if (model != null) {
                
                // Default theme.
                string defaultTheme = "theme1";

                // If current user is authenticate, get theme from account.
                // Otherwise, get from cookie.
                if (filterContext.HttpContext.User.Identity.IsAuthenticated) {
                    IAccountService accountService = ObjectFactory.GetInstance<IAccountService>();
                    Account account = accountService.LoadByEmail(filterContext.HttpContext.User.Identity.Name);
                    if (!String.IsNullOrEmpty(account.CurrentTheme))
                        model.CurrentTheme = account.CurrentTheme;
                    else
                        model.CurrentTheme = defaultTheme;
                }
                else {
                    if (filterContext.HttpContext.Request.Cookies.AllKeys.Contains("hover_notes_theme"))
                        model.CurrentTheme = filterContext.HttpContext.Request.Cookies["hover_notes_theme"].Value;
                    else
                        model.CurrentTheme = defaultTheme;
                }

            }
            base.OnActionExecuted(filterContext);
        }
 public override void OnActionExecuted(ActionExecutedContext filterContext)
 {
     BaseViewModel model;
     if (filterContext.Controller.ViewData.Model == null) {
         model = new BaseViewModel();
         filterContext.Controller.ViewData.Model = model;
     }
     else {
         model = filterContext.Controller.ViewData.Model as BaseViewModel;
     }
     if (model != null) {
         model.CurrentUser.IsAuthenticated = filterContext.HttpContext.User.Identity.IsAuthenticated;
         if (model.CurrentUser.IsAuthenticated) {
             model.CurrentUser.Email = filterContext.HttpContext.User.Identity.Name;
         }
     }
     base.OnActionExecuted(filterContext);
 }