Recommended approach to saving and restoring a cell's id

I’m working on an extension and I need a unique identifier for the cells, which naturally led me to considering the notebook cell ID. However, I need the ID to be restored when the notebook is restored; currently cell IDs are not saved in the cell’s metadata, so they cannot be restored.

I tried to save the ID in the metadata then restore using the cells.changed signal, but I don’t see any way of changing the cell’s id after it’s been created. I tried cellModel.modelDB.setValue('id', cellModel.metadata.get('id')) but it gives me the error Can only call setValue on an ObservableValue. Similarly, = '123' gives the error that id is readonly.

Does someone have a suggestion for how I can restore the cell ID? I could also try overriding the cell model’s fromJSON method, but that would be a bit messy for such a simple operation…

Also as a side note, it seems like cellID is added to the metadata, but never saved?

Could you tag (notebook cell tags) each cell with an ID and use that?

Hey I just now saw your response. Tags would almost work except for the fact that they need to be readonly – I don’t want users to be able to delete/edit them