code: private ModelNode resolveExpressionsRecursively(final ModelNode node) throws OperationFailedException {
          if (!node.isDefined()) {
              return node;
          }
  
          ModelType type = node.getType();
          ModelNode resolved;
          if (type == ModelType.EXPRESSION) {
              resolved = resolveExpressionStringRecursively(node.asExpression().getExpressionString(), lenient, true);
          } else if (type == ModelType.OBJECT) {
              resolved = node.clone();
              for (Property prop : resolved.asPropertyList()) {
                  resolved.get(prop.getName()).set(resolveExpressionsRecursively(prop.getValue()));
              }
          } else if (type == ModelType.LIST) {
              resolved = node.clone();
              ModelNode list = new ModelNode();
              list.setEmptyList();
              for (ModelNode current : resolved.asList()) {
                  list.add(resolveExpressionsRecursively(current));
              }
              resolved = list;
          } else if (type == ModelType.PROPERTY) {
              resolved = node.clone();
              resolved.set(resolved.asProperty().getName(), resolveExpressionsRecursively(resolved.asProperty().getValue()));
          } else {
              resolved = node;
          }
  
          return resolved;
      }
docs: Examine the given model node, resolving any expressions found within, including within child nodes.
  
  @param node the node
  @return a node with all expressions resolved
  @throws OperationFailedException if an expression cannot be resolved