refactor _upsert_wf to _update_wf, since this method will never insert
optimize _upsert_wf so that we don't query over a list of thousands of nodes