I refactored existing code (that I needed to reuse) to create this function. Here's the original logic:

https://github.com/juju/juju-gui/blob/72ca25bdf87239e628f74b915cda80f5fa020c93/app/widgets/machine-view-panel.js#L238

On lines 246 and and 251 you can see the `_clearContainerColumn` function call, which is now `cleanup` in the code above.

I think there's a lot of room for improvement in this function. With that said, I was just looking to mimic existing logic in this first round of refactoring, especially since I don't really understand what `_clearContainerColumn` does.