Raise error if object is not persisted