Saving and restoring of view states