Raise error when trying to update a stale object when calling `safeSave` or `safeUpdate`

Lots of copy-paste to leave the existing functions untouched.