Set persisted state instead of relying on id presence.

Fixes #11.