/**
  * Checks the existence of a resource. If the resource exists, {@code true} is returned, otherwise
  * {@code false}.
  *
  * @param address the address of the resource to check.
  * @param client the client used to execute the operation.
  * @return {@code true} if the resources exists, otherwise {@code false}.
  * @throws IOException if an error occurs executing the operation.
  * @throws RuntimeException if the operation fails.
  */
 private boolean resourceExists(final ModelNode address, final ModelControllerClient client)
     throws IOException {
   final Property childAddress = ServerOperations.getChildAddress(address);
   final ModelNode parentAddress = ServerOperations.getParentAddress(address);
   final ModelNode r =
       client.execute(
           ServerOperations.createOperation(ServerOperations.READ_RESOURCE, parentAddress, false));
   reportFailure(r);
   boolean found = false;
   final String name = childAddress.getName();
   if (ServerOperations.isSuccessfulOutcome(r)) {
     for (ModelNode dataSource : ServerOperations.readResult(r).get(name).asList()) {
       if (dataSource.asProperty().getName().equals(childAddress.getValue().asString())) {
         found = true;
       }
     }
   }
   return found;
 }