Add test for document recreation.

When deleting a document and then trying to recreate it something goes wrong. This pull requests adds a failing test for that. Any ideas on how to fix this?