                     return
                 }
 
-                NotificationCenter.default.post(name: .MassServiceDidUpdate,
-                                                object: self)
+                DispatchQueue.main.async {
+                    NotificationCenter.default.post(name: .MassServiceDidUpdate,
+                                                    object: self)
+                }
                 completion()
             }
             

                                      metadata: metadata)
        
        healthStore.save(sample) { (success, error) in
            completion(error)
        }
    }



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

