             return
         })
         
+        // perform Core Data validation (to make sure there will be no errors saving)
+        
+        var validCoreData: Bool = false
+        
+        context.performBlockAndWait({ () -> Void in
+            
+            validCoreData = managedObject!.validateForUpdate(nil)
+        })
+        
+        // invalid (e.g. non-optional property is nil)
+        if !validCoreData {
+            
+            let response = ServerResponse(statusCode: ServerStatusCode.BadRequest, JSONResponse: nil)
+            
+            return (response, userInfo)
+        }
+        
         let response = ServerResponse(statusCode: ServerStatusCode.OK, JSONResponse: nil)
         
         return (response, userInfo)

                
                return (response, userInfo)
            }
        }
        
        // delete...

        
        var editError: NSError?
        
        // validate and convert JSON
        context.performBlockAndWait({ () -> Void in
            
            editStatusCode = self.verifyEditResource(managedObject!, forRequest: request, context: context, newValues: &newValues, error: &editError)
