/**
   * Updates the vm associated to the vmServiceLink with the vm Identifier.
   *
   * @param currentState
   * @param vmId
   */
  private void updateVmId(final State currentState, String vmId) {
    Operation.CompletionHandler completionHandler =
        new Operation.CompletionHandler() {
          @Override
          public void handle(Operation operation, Throwable throwable) {
            if (null != throwable) {
              failTask(throwable);
              return;
            }
            queryContainers(currentState);
          }
        };

    VmService.State vmPatchState = new VmService.State();
    vmPatchState.vmId = vmId;
    Operation patchOperation =
        Operation.createPatch(UriUtils.buildUri(getHost(), currentState.vmServiceLink))
            .setBody(vmPatchState)
            .setCompletion(completionHandler);

    sendRequest(patchOperation);
  }