nl_tokens: Remove the given datasetClients
pl_tokens: function doRemoveDatasetClients ( datasetClientsToRemove , cb ) { var removeIds = _ . pluck ( datasetClientsToRemove , 'id' ) ; var datasetIds = _ . uniq ( _ . pluck ( datasetClientsToRemove , 'datasetId' ) ) ; debug ( 'doRemoveDatasetClients: removed datasetClients = %d, datasets = %d' , removeIds . length , datasetIds . length ) ; async . series ( [ function deleteDatasetClientAndRefs ( callback ) { async . map ( removeIds , doRemoveDatasetClientWithRecords , function ( err , deleteResult ) { if ( err ) { debug ( 'Failed to delete datasetClients due to error %s' , err ) ; } return callback ( err , deleteResult ) ; } ) ; } , function removeUnusedRecords ( callback ) { async . map ( datasetIds , removeRecordsForDataset , function ( err , deletedCount ) { if ( err ) { debug ( 'Error occured when delete records for dataset due to error %s' , err ) ; } return callback ( err , deletedCount ) ; } ) ; } ] , function ( err , results ) { if ( err ) { return cb ( <mask> ) ; } else { return cb ( null , results [ 0 ] ) ; } } ) ; }