29249 move common logic to toolbox

@hippee-lee, @tsanko, @kevinsproles @texasag update PR with the right destination branch.