Implemented the Document API + integration tests