Refactored Document IDs to be consistent across DatabaseConnector

In order to fix various issues with caching, it became apparent that the major issue was document ids being represented as Objects. Since that was the case, we could not reliably keep one type of document id in the cache and another in the back end. 

Converting between the two became incredibly complicated, and would often completely fail.

This pull request adresses that issue. 

(Since it's a low level change on the Document API classes, it has some rather large effects, hence the 105 files changed)