         }
     }
     
-    private func fetchEntity(entity: NSEntityDescription, withResourceID resourceID: Int, usingContext context: NSManagedObjectContext, shouldPrefetch: Bool) -> (NSManagedObject, NSError) {
+    private func fetchEntity(entity: NSEntityDescription, withResourceID resourceID: Int, usingContext context: NSManagedObjectContext, shouldPrefetch: Bool) -> (NSManagedObject?, NSError?) {
         
         let fetchRequest = NSFetchRequest(entityName: entity.name)
         

        
        let predicateOperatorObject: AnyObject? = searchParameters![SearchParameter.PredicateOperator.toRaw()]
        
        let predicateOperator = predicateOperatorObject as? UInt
        
        if (predicateKey != nil) && (predicateOperator != nil) && (jsonPredicateValue != nil) {
            
            // validate comparator
            
            if predicateOperator == NSPredicateOperatorType.CustomSelectorPredicateOperatorType.toRaw() {
                
                let response = ServerResponse(statusCode: ServerStatusCode.BadRequest, JSONResponse: nil)
                

            // attribute value
            if attributeDescription != nil {
                
                // set value
                value = entity.attributeValueForJSONCompatibleValue(JSONCompatibleValue: jsonPredicateValue!, forAttribute: predicateKey!)!
            }
            
