I think this does not needs to be a mapping between object to object, it could be just unsaved item to an id, in fact I'd abstract it in function:

```js
let id = (item) => item.id || idMap.get(item)
```