Add state restoring for entities