When saving an entity, allow $id to be set to ent.id if ent.id$ and ent._id are undefined