   * Route for sending push notification (this uses the Push server SDK).
   */
   router.post("/push/images/:imageId") { request, response, next in
-    guard let imageId = request.params["imageId"] else {
-      response.error = generateInternalError()
-      response.status(HTTPStatusCode.badRequest)
-      next()
-      return
-    }
-
+    // Define response body
     var responseBody = JSON([:])
     responseBody["status"].boolValue = false
+
+    guard let imageId = request.params["imageId"] else {
+      //response.error = generateInternalError()
+      response.status(HTTPStatusCode.badRequest)
+      response.send(json: responseBody)
+      next()
+      return
+    }
+
     readImage(database: database, imageId: imageId) { (jsonImage) in
       if let jsonImage = jsonImage {
         let apnsSettings = Notification.Settings.Apns(badge: nil, category: "imageProcessed", iosActionKey: nil, sound: nil, type: ApnsType.DEFAULT, payload: jsonImage.dictionaryObject)

        pushNotificationsClient.send(notification: notification) { (error) in
          if let error = error {
            Log.error("Failed to send push notification: \(error)")
            response.error = generateInternalError()
            response.status(HTTPStatusCode.internalServerError)
          } else {
            response.status(HTTPStatusCode.OK)

          next()
        }
      } else {
        //response.error = generateInternalError()
        response.status(HTTPStatusCode.internalServerError)
        response.send(json: responseBody)
        next()
