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

    }
}

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

        }
    }
    
    //  MARK: - Delegate
    
    public func addDelegate(_ delegate: MXThreadingServiceDelegate) {
        multicastDelegate.addDelegate(delegate)
    }
    
    public func removeDelegate(_ delegate: MXThreadingServiceDelegate) {
        multicastDelegate.removeDelegate(delegate)
    }
    
    public func removeAllDelegates() {
        multicastDelegate.removeAllDelegates()
    }
    
    private func notifyDidUpdateThreads() {
        multicastDelegate.invoke({ $0.threadingServiceDidUpdateThreads(self) })
    }
    
}
