Fix model commit to database.

The previous fix (bb7087f) to prevent unnecessary commits to the
database broke storing models when setting IsPersisted (and not changing
anything else - exactly what sync does), so those models would just
hover around in memory until collected by GC.