I tried implementing this myself but I found some weird 'feature'. When I get the itemdef of an unnoted item, the noteID is the correct notedID. When I get the itemdef of a noted item, the id is the noted id, and the notedID is the normal id.
For this reason I was unable to implement this. I wonder if others are having the same issue.