It is pretty easy to create a pair of text documents with the same content, the same content would result in the same ResourceId. We should prevent creation of resources with duplicated id.
There are 2 ways of solving this:
- Calculate
ResourceId of note being saved, lookup into the index for this id.
If the id is already existing — forbid saving of the note.
- Automatically add nonce to the note.
This requires changing structure of a note — it can't be plain text anymore,
we need to add nonce into separate field of it.