code: public ModelNode findNodeInList(Address addr, String haystack, String needle) throws Exception {
          final ModelNode queryNode = createRequest(READ_RESOURCE, addr);
          final ModelNode results = execute(queryNode);
          if (isSuccess(results)) {
              final ModelNode haystackNode = getResults(results).get(haystack);
              if (haystackNode.getType() != ModelType.UNDEFINED) {
                  final List<ModelNode> haystackList = haystackNode.asList();
                  for (ModelNode needleNode : haystackList) {
                      if (needleNode.has(needle)) {
                          return needleNode;
                      }
                  }
              }
              return null;
          } else {
              throw new FailureException(results, "Failed to get data for [" + addr + "]");
          }
      }
docs: This tries to find specific node within a list of nodes. Given an address and a named node
  at that address (the "haystack"), it is assumed that haystack is actually a list of other
  nodes. This method looks in the haystack and tries to find the named needle. If it finds it,
  that list item is returned. If it does not find the needle in the haystack, it returns null.
  
  For example, if you want to find a specific datasource in the list of datasources, you
  can pass in the address for the datasource subsystem, and ask to look in the data-source
  node list (the haystack) and return the named datasource (the needle).
  
  @param addr resource address
  @param haystack the collection
  @param needle the item to find in the collection
  @return the found item or null if not found
  @throws Exception if the lookup fails for some reason