                 return
             }
             
-            
-            
+            var managedObject: NSManagedObject?
+            
+            self.privateQueueManagedObjectContext.performBlockAndWait({ () -> Void in
+                
+                // create new entity
+                managedObject = NSEntityDescription.insertNewObjectForEntityForName(name, inManagedObjectContext: self.privateQueueManagedObjectContext) as? NSManagedObject
+                
+                // set resourceID
+                managedObject?.setValue(resourceID, forKey: self.resourceIDAttributeName)
+                
+                // set values
+                if initialValues != nil {
+                    
+                    for (key, value) in initialValues! {
+                        
+                        // Core Data cannot hold NSNull
+                        if let null = value as? NSNull {
+                            
+                            managedObject!.setValue(nil, forKey: key)
+                        }
+                        else {
+                            managedObject!.setValue(value, forKey: key)
+                        }
+                    }
+                }
+                
+                // set date cached
+                self.didCacheManagedObject(managedObject!)
+                
+                // save
+                let saveError = NSErrorPointer()
+                
+                if !self.privateQueueManagedObjectContext.save(saveError) {
+                    
+                    completionBlock(error: saveError.memory, managedObject: nil)
+                    
+                    return
+                }
+            })
+            
+            // get the corresponding managed object that belongs to the main queue context
+            var mainContextManagedObject: NSManagedObject?
+            
+            self.managedObjectContext.performBlockAndWait({ () -> Void in
+                
+                mainContextManagedObject = self.managedObjectContext.objectWithID(managedObject!.objectID)
+            })
+            
+            completionBlock(error: nil, managedObject: mainContextManagedObject)
         })
     }
     

                self.didCacheManagedObject(resource!)
                
                // save
                
                let saveError = NSErrorPointer()
                
                if !self.privateQueueManagedObjectContext.save(saveError) {

    // MARK: - Requests
    
    /** Performs a search request on the server. The supplied fetch request's predicate must be a NSComparisonPredicate. */
    public func performSearch(fetchRequest: NSFetchRequest, URLSession: NSURLSession, completionBlock: ((error: NSError?, results: [NSManagedObject]?) -> Void)) -> NSURLSessionDataTask {
        
        // build JSON request from fetch request
        
