Fixed add so that it returns an id fof the new document.