                     
                     // make sure all the values are present and have the correct permissions...
                     
-                    if newValue.count != destinationResourceIDs?.count {
+                    if newValue!.count != destinationResourceIDs?.count {
                         
                         return ServerStatusCode.BadRequest
                     }
                     
                     for destinationResourceID in destinationResourceIDs! {
                         
-                        let destinationResource = newValue[find(destinationResourceIDs!, destinationResourceID)!]
+                        let destinationResource = newValue![find(destinationResourceIDs!, destinationResourceID)!]
                         
                         // destination resource must be visible
                         if self.permissionsEnabled {

                    }
                    
                    // not found
                    if fetchResult.count != jsonPredicateValue?.count {
                        
                        let response = ServerResponse(statusCode: ServerStatusCode.BadRequest, JSONResponse: nil)
                        

            result = context.executeFetchRequest(fetchRequest, error: &error) as? [NSManagedObject]
        }
        
        return (result?.first, error)
    }
    
    private func fetchEntity(entity: NSEntityDescription, withResourceIDs resourceIDs: [UInt], usingContext context: NSManagedObjectContext, shouldPrefetch: Bool) -> ([NSManagedObject]?, NSError?) {
        
        let fetchRequest = NSFetchRequest(entityName: entity.name!)
        
        fetchRequest.fetchLimit = resourceIDs.count
        
        fetchRequest.predicate = NSComparisonPredicate(leftExpression: NSExpression(forKeyPath: self.resourceIDAttributeName), rightExpression: NSExpression(forConstantValue: resourceIDs), modifier: NSComparisonPredicateModifier.DirectPredicateModifier, type: NSPredicateOperatorType.InPredicateOperatorType, options: NSComparisonPredicateOptions.NormalizedPredicateOption)
        
