UpdateVirtualMachine: code cleanup - got rid of warnings and unused code from the method; extracted part of the code to its separate method.