/**
   * This method sets the node(s) to publish or unpublish on the supplied publishing details. If the
   * actionedUponNode is a folder then it will include all content nodes within that folder.
   *
   * @param actionedUponNodeRef
   * @param unpublish
   * @param details
   */
  private List<NodeRef> setNodes(
      NodeRef actionedUponNodeRef, boolean unpublish, PublishingDetails details) {
    List<NodeRef> nodes = new ArrayList<NodeRef>();
    QName nodeType = nodeService.getType(actionedUponNodeRef);
    if (dictionaryService.isSubClass(nodeType, ContentModel.TYPE_FOLDER)) {
      List<ChildAssociationRef> children = nodeService.getChildAssocs(actionedUponNodeRef);
      for (ChildAssociationRef childRef : children) {
        NodeRef child = childRef.getChildRef();
        if (dictionaryService.isSubClass(nodeService.getType(child), ContentModel.TYPE_CONTENT)) {
          nodes.add(child);
        }
      }
    } else {
      nodes.add(actionedUponNodeRef);
    }

    if (unpublish) {
      details.addNodesToUnpublish(nodes);
    } else {
      details.addNodesToPublish(nodes);
    }
    return nodes;
  }