         }
     }
     
-    func fallbackToBestAttemptContent(forEventId eventId: String) {
+    private func fallbackToBestAttemptContent(forEventId eventId: String) {
         NSLog("[NotificationService] fallbackToBestAttemptContent: method called.")
         
         guard let content = bestAttemptContents[eventId] else {

class NotificationService: UNNotificationServiceExtension {
    
    /// Content handlers. Keys are eventId's
    var contentHandlers: [String: ((UNNotificationContent) -> Void)] = [:]
    
    /// Best attempt contents. Will be updated incrementally, if something fails during the process, this best attempt content will be showed as notification. Keys are eventId's
    var bestAttemptContents: [String: UNMutableNotificationContent] = [:]
    
    /// Cached events. Keys are eventId's
    var cachedEvents: [String: MXEvent] = [:]
    static var mxSession: MXSession?
    static var syncResponseStore: SyncResponseStore?
    var showDecryptedContentInNotifications: Bool {
        return RiotSettings.shared.showDecryptedContentInNotifications
    }
    lazy var configuration: Configurable = {
        return CommonConfiguration()
    }()
    static var isLoggerInitialized: Bool = false
    private lazy var pushGatewayRestClient: MXPushGatewayRestClient = {
        let url = URL(string: BuildSettings.serverConfigSygnalAPIUrlString)!
        return MXPushGatewayRestClient(pushGateway: url.scheme! + "://" + url.host!, andOnUnrecognizedCertificateBlock: nil)

    }
    
    func fetchEvent(withEventId eventId: String, roomId: String, allowSync: Bool = true) {
        NSLog("[NotificationService] fetchEvent")
        
        NotificationService.backgroundSyncService.event(withEventId: eventId,
                                                        inRoom: roomId,
                                                        completion: { (response) in
                                                            switch response {
                                                            case .success(let event):
                                                                NSLog("[NotificationService] fetchEvent: Event fetched successfully")
                                                                self.processEvent(event)
                                                            case .failure(let error):
                                                                NSLog("[NotificationService] fetchEvent: error: \(error)")
                                                                self.fallbackToBestAttemptContent(forEventId: eventId)
                                                            }
        })
    }
    
    private func processEvent(_ event: MXEvent) {
        guard let content = bestAttemptContents[event.eventId], let userAccount = userAccount else {
            self.fallbackToBestAttemptContent(forEventId: event.eventId)
            return
        }

        self.notificationContent(forEvent: event, forAccount: userAccount) { (notificationContent) in
            var isUnwantedNotification = false
            
            // Modify the notification content here...
