Optimising vSphere API Code