public QueryDefinition createQuerty(String name, Class<? extends JPanel> panel, Environment env) throws Exception {
		
		Node node = null;
		try {
			Element queryElem = getOrCreateCollection("queries");
			node = Utilities.selectSingleNode(queryElem, "./c:query[@c:name='" + name + "']", this.namespaces);
			if(node == null) {
				
				node = this.doc.createElementNS(Settings.DEFAULT_NAMESPACE, "query");
				Utilities.setAttribute(node, "c", "contentType", QueryDefinition.DEFAULT_CONTENT_TYPE, this.namespaces);
				Utilities.setAttribute(node, "c", "environment", env.getName(), this.namespaces);
				Utilities.setAttribute(node, "c", "name", name, this.namespaces);
				Utilities.setAttribute(node, "c", "queryId", "", this.namespaces);
				Utilities.setAttribute(node, "c", "transform", "", this.namespaces);
				Utilities.setAttribute(node, "c", "type", panel.getName(), this.namespaces);
				queryElem.appendChild(node);
			}
		} catch(Exception e) {
			logger.warn("Unable to create query: " + name, e);
		}
		
		return new QueryDefinition(node);
	}