refactoring out promises in upserts