save state  app delegate