Per our conversatoin, let's refactor bulk_download (and bulk_delete) to take a list of filenames so you don't have to munge the data here. docs_selected is currently a list of dicts; if we only ever use doc['name'], then a list of filenames is cleaner and clearer.