         
         //NSParameterAssert(aID != 0);
         
-        var result : Node? = nil //self.nodeStore.readObject(aID)
-        
-        //TODO
-        //result.context = self
+        var result : Node? = nil //nodeStore.readObject(aID)
+        
+        if (result != nil) {
+            result!.context = self
+        }
         
         return result;
     }
     
     func updateNode(aNode: Node) {
-        self.nodeStore.updateObject(aNode)
+        nodeStore.updateObject(aNode)
     }
 
     func deleteNode(aNode: Node) {
-        self.nodeStore.deleteObject(aNode)
+        nodeStore.deleteObject(aNode)
         
         aNode.context = nil;
     }

            var fileManager = NSFileManager.defaultManager()
            
            error = nil;  // remove file not found error
            //fileManager.createDirectoryAtURL:self.url withIntermediateDirectories:YES attributes:nil error:&error];
            
            fileManager.createDirectoryAtURL(self.url, withIntermediateDirectories: true, attributes: nil, error:&error)
            
            
            // TODO
            self.error = error;
        }
        
        var nodeStoreURL = self.url.URLByAppendingPathComponent(cNodeStoreFileName)
        self.nodeStore = ObjectStore<Node>(url: nodeStoreURL)
        self.nodeStore.cache.name = "nodeStore"  // TODO: automate
        
        var relationshipStoreURL = self.url.URLByAppendingPathComponent(cRelationshipStoreFileName)
        self.relationshipStore = ObjectStore<Relationship>(url:relationshipStoreURL)
        //self.relationshipStore.setupStore(SORelationship())
        self.nodeStore.cache.name = "relationshipStore"
        
        var propertyStoreURL = self.url.URLByAppendingPathComponent(cPropertyStoreFileName)
        self.propertyStore = ObjectStore<Property>(url: propertyStoreURL)
        //self.propertyStore.setupStore(SOProperty())
        self.propertyStore.cache.name = "propertyStore"
        
        var stringStoreURL = self.url.URLByAppendingPathComponent(cStringStoreFileName)
        self.stringStore = StringStore(url:stringStoreURL)
    }
    
    func setCacheLimit(newValue: Int) {
        self.nodeStore.cache.countLimit = newValue
        self.relationshipStore.cache.countLimit = newValue
    }
    
    func setCacheDelegate(newValue: NSCacheDelegate) {
        self.nodeStore.cache.delegate = newValue;
        self.relationshipStore.cache.delegate = newValue;
        self.propertyStore.cache.delegate = newValue;
    }
    
    // MARK: CRUD Node

    deinit {
        
        // should close all files
        nodeStore = nil;
        relationshipStore = nil;
        propertyStore = nil;
        stringStore = nil;
        
        if temporary {
            url.deleteFile()
