         if let thread = thread(withId: threadIdentifier) {
             //  add event to the thread if found
             thread.addEvent(event)
+            notifyDidUpdateThreads()
         } else {
             //  create the thread for the first time
             let thread: MXThread

            thread.addEvent(event)
            saveThread(thread)
            NotificationCenter.default.post(name: Self.newThreadCreated, object: thread, userInfo: nil)
        }
    }
    

    }
}

@objc
public protocol MXThreadingServiceDelegate: AnyObject {
    func threadingServiceDidUpdateThreads(_ service: MXThreadingService)
}

@objcMembers
public class MXThreadingService: NSObject {
    
    private weak var session: MXSession?
    
    private var threads: [String: MXThread] = [:]
    private let multicastDelegate: MXMulticastDelegate<MXThreadingServiceDelegate> = MXMulticastDelegate()
    
    public static let newThreadCreated: Notification.Name = Notification.Name("MXThreadingService.newThreadCreated")
    
