optimize _upsert_wf so that we don't query over a list of thousands of nodes