      - returns: List of file paths from document directory
      */
     func paths(from directory: FileManager.SearchPathDirectory = .documentDirectory, filter: ((URL) -> Bool)? = nil) -> [String] {
-        let root = FileManager.default.urls(for: directory, in: .userDomainMask).first!
-        
-        // Get the directory contents including folders
-        guard var directoryUrls = try? contentsOfDirectory(
-            at: root,
-            includingPropertiesForKeys: nil)
-            else { return [String]() }
-        
-        // Filter the directory contents if applicable
-        if let filter = filter {
-            directoryUrls = directoryUrls.filter(filter)
-        }
-        
-        return directoryUrls.map { $0.path }
+        return urls(from: directory, filter: filter).map { $0.path }
     }
-    
 }
 
 

     
     - parameter fileName: Name of file
     
     - returns: File path from document directory
     */
    func path(of fileName: String, from directory: FileManager.SearchPathDirectory = .documentDirectory) -> String {
        let root = NSSearchPathForDirectoriesInDomains(directory, .userDomainMask, true).first!
        return URL(fileURLWithPath: root).appendingPathComponent(fileName).path
    }
    
    /**

        guard let nsURL = URL(string: url) else { return complete(nil, nil, ZamzamError.invalidData) }
        
        URLSession.shared.downloadTask(with: nsURL) {
            let response = $0.1
            let error = $0.2
            
            guard error == nil, let location = $0.0 else { return complete(nil, nil, error) }
            
            // Construct file destination and prepare location
            let destination = self.url(of: nsURL.lastPathComponent, from: .cachesDirectory)
            _ = try? self.removeItem(at: destination)
            
            // Store remote file locally
            do { try self.moveItem(at: location, to: destination) }
            catch { return complete(nil, nil, error) }
            
            complete(destination, response, error)
        }.resume()
    }
}
