Screen capture of each branch in a tree

Looking to batch export screenshots of each branch in a tree to specific directories, more or less a "preview" of the geometry in each branch. I am trying to avoid animating of sliders and thus far my C# attempts have failed.

My logic thus far has been:

For each branch in tree

UpdateViewportImage

CaptureToBitmap

Output to respective directory with specified filename

Funny that it would be very simple to export the geometry this way, but I am having a hard time doing the same with an image. 

Inputs on my C# are:

Tree with Geomety

target directory

filename

toogle for export

Any insight would be most appreciated.