docs: public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
  
          final PathAddress pa = context.getCurrentAddress();
          // if we're not already at the root, call this at the root as an immediate step
          if (!pa.equals(PathAddress.EMPTY_ADDRESS)) {
              final ModelNode cloned = operation.clone();
              cloned.get(OP_ADDR).set(PathAddress.EMPTY_ADDRESS.toModelNode());
              context.attach(HOST_NAME, pa.getLastElement().getValue());
              context.addStep(cloned, this, OperationContext.Stage.MODEL, true);
              return;
          }
  
          // see if a host has already been added.
          Resource root = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, false);
          if (root.getChildrenNames(HOST).size() > 0) {
              // there is a host already registered
              final String exists = root.getChildrenNames(HOST).iterator().next();
              throw HostControllerLogger.ROOT_LOGGER.cannotAddHostAlreadyRegistered(exists);
          }
  
          final String hostName = context.getAttachment(HOST_NAME);
          if (hostName == null) {
              throw HostControllerLogger.ROOT_LOGGER.nullHostName();
          }
  
          boolean persistName = false;
          if (operation.has(ModelDescriptionConstants.PERSIST_NAME)) {
              persistName = operation.get(ModelDescriptionConstants.PERSIST_NAME).asBoolean();
          }
  
          boolean isDomainController = true;
          if (operation.has(ModelDescriptionConstants.IS_DOMAIN_CONTROLLER)) {
              isDomainController = operation.get(ModelDescriptionConstants.IS_DOMAIN_CONTROLLER).asBoolean();
          }
  
          final ModelNode dc = new ModelNode();
          if (isDomainController) {
              dc.get(LOCAL).setEmptyObject();
          } else {
              dc.get(REMOTE).setEmptyObject();
          }
  
          if (!context.isBooting() && !isDomainController) {
              // this is a slave add using /host=foo:add() manually. Don't allow this.
              throw HostControllerLogger.ROOT_LOGGER.cannotAddSlaveHostAfterBoot();
          }
  
          context.registerCapability(HOST_RUNTIME_CAPABILITY);
  
          final PathAddress hostAddress = PathAddress.pathAddress(PathElement.pathElement(HOST, hostName));
          final LocalHostControllerInfo localHostControllerInfo = hostDefinition.getLocalHostControllerInfo();
          // register as DC or slave, we do this before registering the host definition.
          ((LocalHostControllerInfoImpl) localHostControllerInfo).setMasterDomainController(isDomainController || !context.isBooting());
  
          hostDefinition.registerHostModel(hostName);
          final Resource rootResource = context.createResource(hostAddress);
          final ModelNode model = rootResource.getModel();
          model.get(DOMAIN_CONTROLLER).set(dc);
          hostDefinition.initCoreModel(model);
  
          // check to see if we need to enable domainController to allow host op routing
          // this is only used during an empty config boot, the parsers will add the necessary op
          // for a normal boot.
          if (isDomainController || !context.isBooting()) {
              final ManagementResourceRegistration rootRegistration = context.getResourceRegistrationForUpdate();
              final ModelNode update = new ModelNode();
              update.get(OP_ADDR).set(hostAddress.toModelNode());
              update.get(OP).set(LocalDomainControllerAddHandler.OPERATION_NAME);
              context.attach(HOST_ADD_AFTER_BOOT, !context.isBooting());
              context.addStep(update, rootRegistration.getOperationHandler(hostAddress, LocalDomainControllerAddHandler.OPERATION_NAME), OperationContext.Stage.MODEL, true);
          }
          hostDefinition.initModelServices(context, hostAddress, rootResource);
  
          // if we added with /host=foo:add(persist-name=true) write-attribute on the hc name
          if (!context.isBooting() && persistName) {
              final ManagementResourceRegistration rootRegistration = context.getResourceRegistrationForUpdate();
              final ModelNode name = new ModelNode();
              name.get(OP_ADDR).set(hostAddress.toModelNode());
              name.get(OP).set(WRITE_ATTRIBUTE_OPERATION);
              name.get(ModelDescriptionConstants.NAME).set(ModelDescriptionConstants.NAME);
              name.get(ModelDescriptionConstants.VALUE).set(hostName);
              context.addStep(name, rootRegistration.getOperationHandler(hostAddress, WRITE_ATTRIBUTE_OPERATION), OperationContext.Stage.MODEL, false);
          }
      }