 
     func logoutThenDeleteAllStoredData() {
         cancelAllRunningTasks { () -> Void in
+
             self.logout(success: { () -> Void in
                 // get run for every time a sucessful scope logs out
                 }) { (error) -> () in

            let task = self.urlSessionTask(httpMethod.post, url: logoutURI, success: success, failure: failure)
            task.resume()

            if let fullHighAuthToken = OAuthToken.oAuthTokenWithScope(kOauth2ScopeFullHighAuth) {
                self.validate(token: fullHighAuthToken, then: {
                    let task = self.urlSessionTask(httpMethod.post, url: logoutURI, success: success, failure: failure)
                    task.resume()
                })
            }
            if let idPorten3Token = OAuthToken.oAuthTokenWithScope(kOauth2ScopeFull_Idporten3) {
                self.validate(token: idPorten3Token, then: {
                    let task = self.urlSessionTask(httpMethod.post, url: logoutURI, success: success, failure: failure)
                    task.resume()
                })
            }
            if let idPorten4Token = OAuthToken.oAuthTokenWithScope(kOauth2ScopeFull_Idporten4) {
                self.validate(token: idPorten4Token, then: {
                    let task = self.urlSessionTask(httpMethod.post, url: logoutURI, success: success, failure: failure)
                    task.resume()
                })
            }

            OAuthToken.removeAllTokens()
            POSModelManager.sharedManager().deleteAllObjects()
            POSFileManager.sharedFileManager().removeAllFiles()

        }) { (error) -> Void in
            OAuthToken.removeAllTokens()
            POSModelManager.sharedManager().deleteAllObjects()
            POSFileManager.sharedFileManager().removeAllFiles()
        }
    }


    private func validate(#oAuthToken: OAuthToken?, validationSuccess: (chosenToken: OAuthToken) -> Void, failure: ((error: NSError) -> Void)?) {
        if oAuthToken?.hasExpired() == false {
            validationSuccess(chosenToken: oAuthToken!)
            return
        }

        if (oAuthToken?.refreshToken != nil && oAuthToken?.refreshToken != "") {
