Added try/catch around inserting new document