code: protected static List<NodeInterface> getUnattachedNodes(final App app, final SecurityContext securityContext, final WebSocketMessage webSocketData) throws FrameworkException {
  
  		final String sortOrder = webSocketData.getSortOrder();
  		final String sortKey   = webSocketData.getSortKey();
  
  		Query query;
  		if (sortKey != null) {
  
  			final PropertyKey sortProperty = StructrApp.key(DOMNode.class, sortKey);
  			query = StructrApp.getInstance(securityContext).nodeQuery().includeHidden().sort(sortProperty).order("desc".equals(sortOrder));
  
  		} else {
  
  			query = StructrApp.getInstance(securityContext).nodeQuery().includeHidden();
  		}
  
  		query.orTypes(DOMElement.class);
  		query.orType(Content.class);
  		query.orType(Template.class);
  
  		// do search
  		final List<NodeInterface> filteredResults = new LinkedList();
  		List<? extends GraphObject> resultList    = null;
  
  		try (final Tx tx = app.tx()) {
  
  			resultList = query.getAsList();
  			tx.success();
  
  		} catch (FrameworkException fex) {
  			logger.warn("Exception occured", fex);
  		}
  
  		if (resultList != null) {
  
  			// determine which of the nodes have no incoming CONTAINS relationships and no page id
  			for (GraphObject obj : resultList) {
  
  				if (obj instanceof DOMNode) {
  
  					DOMNode node = (DOMNode) obj;
  
  					if (!node.hasIncomingRelationships(node.getChildLinkType()) && node.getOwnerDocument() == null && !(node instanceof ShadowDocument)) {
  
  						filteredResults.add(node);
  					}
  				}
  			}
  		}
  
  		return filteredResults;
  
  	}
docs: Return list of nodes which are not attached to a page and have no
  parent element (no incoming CONTAINS rel)
  
  @param app
  @param securityContext
  @param webSocketData
  @return
  @throws FrameworkException