public void modifyAssignment(
      final Assignment assignment, final String operation, final String successMessage) {
    String serverGroup = assignment.getServerGroup();
    ResourceAddress address =
        new ResourceAddress()
            .add("server-group", serverGroup)
            .add("deployment", assignment.getName());
    Operation op = new Operation.Builder(operation, address).build();

    // wrap the operation in a single flow to show the progress indicator in the footer
    new Async<FunctionContext>(Footer.PROGRESS_ELEMENT)
        .single(
            new FunctionContext(),
            control -> dispatcher.execute(new DMRAction(op), new FunctionCallback(control)),
            new Outcome<FunctionContext>() {
              @Override
              public void onFailure(final FunctionContext context) {
                Console.error("Unable to modify deployment.", context.getErrorMessage());
              }

              @Override
              public void onSuccess(final FunctionContext context) {
                Console.info(successMessage);
                loadAssignments(serverGroup);
              }
            });
  }
 public void verifyEnableDisableAssignment(final Assignment assignment) {
   String question;
   String operation;
   String successMessage;
   if (assignment.isEnabled()) {
     operation = "undeploy";
     question = "Disable " + assignment.getName();
     successMessage = assignment.getName() + " successfully disabled.";
   } else {
     operation = "deploy";
     question = "Enable " + assignment.getName();
     successMessage = assignment.getName() + " successfully enabled.";
   }
   Feedback.confirm(
       Console.CONSTANTS.common_label_areYouSure(),
       question,
       isConfirmed -> {
         if (isConfirmed) {
           modifyAssignment(assignment, operation, successMessage);
         }
       });
 }