public static T Ensure <T>(this HttpSessionState state, string key) where T : class, new()
        {
            var value = state.Get <T>(key);

            if (value == null)
            {
                value = new T();
                state.Set(key, value);
            }

            return(value);
        }