public static View GetBySession(Context context, SiteSettings ss, bool setSession = true)
        {
            var useUsersView = ss.SaveViewType == SiteSettings.SaveViewTypes.User;

            setSession = setSession && ss.SaveViewType != SiteSettings.SaveViewTypes.None;
            var view = !context.Ajax
                ? context.QueryStrings.Data("View")?.Deserialize <View>()
                : null;

            if (view != null)
            {
                SetSession(
                    context: context,
                    ss: ss,
                    view: view,
                    setSession: setSession,
                    useUsersView: useUsersView);
                return(view);
            }
            if (context.Forms.ControlId() == "ViewSelector")
            {
                view = ss.Views
                       ?.Where(o => o.Accessable(context: context))
                       .FirstOrDefault(o => o.Id == context.Forms.Int("ViewSelector"))
                       ?? new View(
                    context: context,
                    ss: ss);
                SetSession(
                    context: context,
                    ss: ss,
                    view: view,
                    setSession: setSession,
                    useUsersView: useUsersView);
                return(view);
            }
            var sessionData = useUsersView ? context.UserSessionData : context.SessionData;

            view = sessionData.Get("View")?.Deserialize <View>()
                   ?? ss.Views?.Get(ss.GridView)
                   ?? new View();
            view.SetByForm(
                context: context,
                ss: ss);
            SetSession(
                context: context,
                ss: ss,
                view: view,
                setSession: setSession,
                useUsersView: useUsersView);
            switch (ss.ReferenceType)
            {
            case "Groups":
                view.AdditionalWhere = GroupUtilities.AdditionalWhere(
                    context: context,
                    view: view);
                break;
            }
            return(view);
        }