private Element getOrCreateCollection(String collectionName) throws Exception {
		
		if(this.doc == null) {
			this.doc = Utilities.createDocument();
		}

		Element docElem = this.doc.getDocumentElement();
		if(docElem == null) {
			docElem = Utilities.createElement(this.doc, "c", "settings", this.namespaces);
		} else {
			if(!docElem.getLocalName().equals("settings") || !docElem.getNamespaceURI().equals(Settings.DEFAULT_NAMESPACE)) {
				throw new Exception("Document element is not correct.");
			}
		}
		
		NodeList children = docElem.getChildNodes();
		Element elem = null;
		for(int i = 0; i < children.getLength(); ++i) {
			Node child = children.item(i);
			if(child.getNodeType() == Node.ELEMENT_NODE) {
				Element e = (Element) child;
				if(e.getLocalName().equals(collectionName) && e.getNamespaceURI().equals(Settings.DEFAULT_NAMESPACE)) {
					elem = e;
					break;
				}
			}
		}		
		
		if(elem == null) {
			elem = this.doc.createElementNS(Settings.DEFAULT_NAMESPACE, collectionName);
			elem.setPrefix("c");
			docElem.appendChild(elem);
		}
		
		save();
		return elem;
	}