insertMasterDocs can now report all failures
This commit introduces a version of `insertMasterDoc` that can process each document insertion separately and collect any exception thrown by the DB layer, returning at the very end a list of failures (if any) alongside the inserted documents. Failures can then be logged and reported to the user and/or in the server logs.