Store re-send messages as well to handle idempotency.

We could already receive duplicate acknowledgments, which caused trouble
with the unique constraint on the messages table. Now we always store
re-sent messages as well. Updated the types to reflect this change.
Use importNode instead of adoptNode.

`adoptNode` sometimes fails by returning `null` causing all kinds of
trouble. `importNode` seems to always work.