         // get resourceID
         let resourceID = managedObject.valueForKey(self.resourceIDAttributeName) as! UInt
         
-        return self.editResource(managedObject.entity, withID: resourceID, changes: jsonValues, URLSession: URLSession, completionBlock: { (httpError) -> Void in
+        return self.editResource(managedObject.entity, withID: resourceID, changes: jsonValues, URLSession: URLSession ?? self.defaultURLSession, completionBlock: { (httpError) -> Void in
             
             if httpError != nil {
                 

        })
    }
    
    public func editManagedObject(managedObject: NSManagedObject, changes: [String: AnyObject], URLSession: NSURLSession = NSURLSession.sharedSession(), completionBlock: ((error: NSError?) -> Void)) -> NSURLSessionDataTask {
        
        // convert new values to JSON
        let jsonValues = managedObject.entity.JSONObjectFromCoreDataValues(changes, usingResourceIDAttributeName: self.resourceIDAttributeName)

        
        // call API method
        
        return self.searchForResource(entity, withParameters: searchParameters, URLSession: URLSession ?? self.defaultURLSession, completionBlock: { (httpError, results) -> Void in
            
            if httpError != nil {
                
