                                       metadata: metadata)
         
         healthStore.save(sample) { (success, error) in
-            completion(error)
+            DispatchQueue.main.async {
+                completion(error)
+            }
         }
     }
 

                    return
                }

                NotificationCenter.default.post(name: .MassServiceDidUpdate,
                                                object: self)
                completion()
            }
            


        healthStore.deleteObjects(of: massType,
                                  predicate: predicate) { (success, deleted, error) in
            DispatchQueue.main.async {
                if deleted == 0 {
                    completion(Error.unableToDelete)
                } else {
                    completion(error)
                }
            }
        }
    }

