 
         EurofurenceApplication.shared.add(authenticationStateObserver: self)
         EurofurenceApplication.shared.add(privateMessagesObserver: self)
+        EurofurenceApplication.shared.add(logoutObserver: self)
         EurofurenceApplication.shared.fetchPrivateMessages()
 
 		favoritesOnlySegmentedControl.selectedSegmentIndex = newsPreferences.doFilterEventFavorites ? 1 : 0

                               UIViewControllerPreviewingDelegate,
                               MessagesViewControllerDelegate,
                               AuthenticationStateObserver,
                               PrivateMessagesObserver {
	@IBOutlet weak var favoritesOnlySegmentedControl: UISegmentedControl!
	@IBOutlet weak var lastSyncLabel: UILabel!


    func privateMessagesAvailable(_ privateMessages: [Message]) {
        let readCount = privateMessages.filter({ $0.isRead }).count
        unreadMessageCount = privateMessages.count - readCount
        reloadUserMessagesBanner()
    }

    func failedToLoadPrivateMessages() {

    }

    func userNotAuthenticatedForPrivateMessages() {

    }

    // MARK: LogoutObserver

    func logoutSucceeded() {
        loggedInUser = nil
        reloadUserMessagesBanner()
    }

    func logoutFailed() {

    }

    // MARK: Private

    private func reloadUserMessagesBanner() {
        let section = IndexSet(integer: 0)
        tableView.reloadSections(section, with: .automatic)
    }

}
