     }
 }
 
+//MARK: Background handling
+
+extension Drosky {
+    
+    private static func backgroundID() -> String {
+        let appName = NSBundle.mainBundle().infoDictionary?[kCFBundleNameKey as String] as? String ?? Drosky.ModuleName
+        return "\(appName)-\(NSUUID().UUIDString)"
+    }
+
+    public var backgroundSessionID: String {
+        get {
+            guard let sessionID = backgroundNetworkManager.session.configuration.identifier else { fatalError("This should have a sessionID") }
+            return sessionID
+        }
+    }
+    
+    public func completedBackgroundTasksURL() -> Future<[NSURL]> {
+        
+        let deferred = Deferred<[NSURL]>()
+        
+        backgroundNetworkManager.delegate.sessionDidFinishEventsForBackgroundURLSession = { session in
+            
+            session.getTasksWithCompletionHandler { (dataTasks, _, _) -> Void in
+                let completedTasks = dataTasks.filter { $0.state == .Completed && $0.originalRequest?.URL != nil}
+                deferred.fill(completedTasks.map { return $0.originalRequest!.URL!})
+                self.backgroundNetworkManager.backgroundCompletionHandler?()
+            }
+        }
+        
+        return Future(deferred)
+    }
+
+}
+
 //MARK:- Errors
 
 public enum DroskyErrorKind: ResultErrorType {

    
    private static let ModuleName = "drosky"
    private let networkManager: Alamofire.Manager
    private lazy var backgroundNetworkManager: Alamofire.Manager = {
        let appName = NSBundle.mainBundle().infoDictionary?[kCFBundleNameKey as String] as? String ?? Drosky.ModuleName
        return Alamofire.Manager(configuration: NSURLSessionConfiguration.backgroundSessionConfiguration("\(appName)-\(NSUUID().UUIDString)"))
    }()
    private let queue = queueForSubmodule(Drosky.ModuleName, qualityOfService: .UserInitiated)
    private let gcdQueue = dispatch_queue_create(Drosky.ModuleName, DISPATCH_QUEUE_SERIAL)
    private let dataSerializer = Alamofire.Request.dataResponseSerializer()
    var router: Router
    
    public init (environment: Environment, signature: Signature? = nil, configuration: NSURLSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration()) {
        networkManager = Alamofire.Manager(configuration: configuration)
        router = Router(environment: environment, signature: signature)
        queue.underlyingQueue = gcdQueue
    }

        let multipartRequestTuple = performUpload(generatedRequest, multipartParameters: multipartParams)
        let processedResponse = multipartRequestTuple.0 ≈> processResponse
        return (processedResponse, multipartRequestTuple.1)
    }

    //MARK:- Internal
