Datastore fixes:

* Add some extra null checks
* Fetch attachments before calling
  getFullRevisionFromCurrentCursor