                     if let message = messageWithMessageID(messageID, inRealm: realm) {
 
                         if message.downloadState != MessageDownloadState.Downloaded.rawValue {
+
+                            let fileName = NSUUID().UUIDString
 
                             switch mediaType {
 

            handleData(data, ofDownloadTask: downloadTask)
        }

        reportProgress(1.0, ofDownloadTask: downloadTask)

        println("didFinishDownloadingToURL \(downloadTask.originalRequest.URL)")
    }

    func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didWriteData bytesWritten: Int64, totalBytesWritten: Int64, totalBytesExpectedToWrite: Int64) {

        let progress: Double = Double(totalBytesWritten) / Double(totalBytesExpectedToWrite)

        reportProgress(progress, ofDownloadTask: downloadTask)

        //println("downloadTask progress \(progress)")
    }
}



extension YepDownloader: NSURLSessionDownloadDelegate {

//    private func reportProgress(progress: Double, ofDownloadTask downloadTask: NSURLSessionDownloadTask) {
//        //progressReporters.filter({ $0.downloadTask == downloadTask }).map({ $0.reportProgressAction?(progress) })
//    }

    private func handleData(data: NSData, ofDownloadTask downloadTask: NSURLSessionDownloadTask) {
        //progressReporters.filter({ $0.downloadTask == downloadTask }).map({ $0.finishedAction(data) })

        for progressReporter in progressReporters {

            for i in 0..<progressReporter.downloadTasks.count {
                if downloadTask == progressReporter.downloadTasks[i] {
                    let finishedAction = progressReporter.finishedActions[i]
                    finishedAction(data)

                    println("finish data of \(downloadTask)")

                    break
                }
            }
        }
    }

    func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didFinishDownloadingToURL location: NSURL) {
