RemberCode State with ID

Hello,

I’ve a question:

I have an editor with different code sections indicated by an Annotation.
Every Code section belongs to exactely one Annotation.

Now I want to remember der combination between Annotation and Code Section - but how?
And the remembered code should be updated regardingly - meaning the relationsship to
the annotation should stay the same.

Any idea?

Thanks.