private void SaveRestorableState(IStateBucket state)
 {
     var viewModelProperties = GetType().GetRuntimeProperties().Where(c => c.GetCustomAttribute(typeof(RestorableStateAttribute)) != null);
     foreach (PropertyInfo propertyInfo in viewModelProperties)
     {
         state[propertyInfo.Name] = propertyInfo.GetValue(this);
     }
 }
 protected virtual void OnSaveState(IStateBucket sessionState) { }
 public void SaveState(IStateBucket state)
 {
     SaveRestorableState(state);
     OnSaveState(state);
 }