     }
     
     func showAlert(message:String){
-        let alert = UIAlertController(title: "Alert".localized, message: message, preferredStyle: UIAlertControllerStyle.alert)
-        alert.addAction(UIAlertAction(title: "OK".localized, style: UIAlertActionStyle.default, handler: nil))
-        self.present(alert, animated: true, completion: nil)
-    }
-
+        delayOnMainQueue {
+            let alert = UIAlertController(title: "Alert".localized, message: message, preferredStyle: UIAlertControllerStyle.alert)
+            alert.addAction(UIAlertAction(title: "OK".localized, style: UIAlertActionStyle.default, handler: nil))
+            self.present(alert, animated: true, completion: nil)
+        }    }
+    
     func showError(message:String){
-        let alert = UIAlertController(title: "Error".localized, message: message, preferredStyle: UIAlertControllerStyle.alert)
-        alert.addAction(UIAlertAction(title: "OK".localized, style: UIAlertActionStyle.cancel))
-        self.present(alert, animated: true, completion: nil)
-    }
+        delayOnMainQueue {
+            let alert = UIAlertController(title: "Error".localized, message: message, preferredStyle: UIAlertControllerStyle.alert)
+            alert.addAction(UIAlertAction(title: "OK".localized, style: UIAlertActionStyle.cancel))
+            self.present(alert, animated: true, completion: nil)
+        }    }
     
     func showError(error:Error){
-        let alert = UIAlertController(title: "Error".localized, message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.alert)
-        alert.addAction(UIAlertAction(title: "OK".localized, style: UIAlertActionStyle.cancel))
-        self.present(alert, animated: true, completion: nil)
+        delayOnMainQueue {
+            let alert = UIAlertController(title: "Error".localized, message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.alert)
+            alert.addAction(UIAlertAction(title: "OK".localized, style: UIAlertActionStyle.cancel))
+            self.present(alert, animated: true, completion: nil)
+        }
     }
     
     func showConnectionError(message:String){
-        let messageConnection = "Please check your internet connection to continue".localized
-        let alert = UIAlertController(title: "You are offline".localized, message: messageConnection, preferredStyle: UIAlertControllerStyle.alert)
-        alert.addAction(UIAlertAction(title: "OK".localized, style: UIAlertActionStyle.cancel))
-        self.present(alert, animated: true, completion: nil)
-    }
+        delayOnMainQueue {
+            let messageConnection = "Please check your internet connection to continue".localized
+            let alert = UIAlertController(title: "You are offline".localized, message: messageConnection, preferredStyle: UIAlertControllerStyle.alert)
+            alert.addAction(UIAlertAction(title: "OK".localized, style: UIAlertActionStyle.cancel))
+            self.present(alert, animated: true, completion: nil)
+        }    }
     
 }
 

        }))
        self.present(alert, animated: true, completion: nil)
    }

    func showDeleteAlert(_ title: String?, message:String?, completion: (()->Void)? = nil){
        let deleteAlert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
        deleteAlert.addAction(UIAlertAction(title: "Delete".localized, style: .destructive, handler: { (action: UIAlertAction!) in

}

extension UIViewController{
    
    func showMessage(_ title: String, message:String, completion: (()->Void)? = nil){
        let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
        alert.addAction(UIAlertAction(title: "OK".localized, style: .default, handler: { (action: UIAlertAction!) in
