     db.bar.save(relatedDoc);     return {success: true}; }); var params = {     doc: doc,     relatedDoc: relatedDoc }; db.transaction(collections, action, params, function (err, result) {     if (err) {         return dfd.reject(err);     }     return dfd.resolve(result); });