             POSModelManager.sharedManager().deleteAllObjects()
             POSFileManager.sharedFileManager().removeAllFiles()
         }
-
-
-
-
+    }
+
+    func cancelAllRunningTasks(then: () -> Void) {
+        self.session.getTasksWithCompletionHandler { (dataTasks, uploadTasks, downloadTasks) -> Void in
+            self.cancelTasks(dataTasks)
+            self.cancelTasks(uploadTasks)
+            self.cancelTasks(dataTasks)
+            then()
+        }
+    }
+
+    private func cancelTasks(tasks: [AnyObject]) {
+        for object in tasks {
+            if let task = object as? NSURLSessionTask {
+                task.cancel()
+            }
+        }
     }
 
     func downloadBaseEncryptionModel(baseEncryptionModel: POSBaseEncryptedModel, withProgress progress: NSProgress, success: () -> Void , failure: (error: APIError) -> ()) {

        }
    }

    func logout() {
        logout(success: { () -> Void in
            // get run for every time a sucessful scope logs out
            }) { (error) -> () in
                // gets run for every failed request
        }
    }



    */
    private func logout(#success: () -> Void, failure: (error: APIError) -> ()) {
        let rootResource = POSRootResource.existingRootResourceInManagedObjectContext(POSModelManager.sharedManager().managedObjectContext)
        if rootResource == nil {
            success()
