They don't scatter and fly like one would think. The main thing is to close off the area where you are working and if you can darken the room leaving one open window or door so any the do fly will go to the light. Even if is nothing more than an open curtain, you can vacuum the bees off the glass later.
The main thing is to gently, as conditions allow, open the cavity and then step back and let them settle back on the comb. As long as comb remains, especially brood, they will naturally gravitate to it. Use that trick to vacuum the bees clear the comb with vac wait until it fills up withbees and clear it again.