@Override
	public void destroy(VirtualMachine virtualMachine) throws Exception {

		if (status(virtualMachine).equals(VirtualMachineStatus.RUNNING)) {
			stop(virtualMachine);
		}
		
		IMachine machine = this.vbox.findMachine(virtualMachine.getName());
		ISession session = getSession(virtualMachine);
		machine.lockMachine(session, LockType.Write);
		try {
			IConsole console = session.getConsole();
			if (machine.getCurrentSnapshot() != null) {
				IProgress deleteSnapshotProg = 
					console.deleteSnapshot(machine.getCurrentSnapshot().getId());
				deleteSnapshotProg.waitForCompletion(-1);
				if (deleteSnapshotProg.getResultCode() != 0) {
					throw new Exception("Cannot delete snapshot from VM. " + 
							deleteSnapshotProg.getErrorInfo().getText());
				}
			}
			IMachine mutable = session.getMachine();
			try {
				mutable.removeStorageController(DISK_CONTROLLER_NAME);
			} catch (VBoxException e) {
				// Do nothing if the controller does not exist
			}
			mutable.saveSettings();
		} catch (Exception e) {
			throw e;
		} finally {
			unlock(session);
		}
		machine.delete(machine.unregister(CleanupMode.Full));
	}