         return enumerator
     }
 
+    // MARK: - Persistent
+
+    private func findItem(for identifier: NSFileProviderItemIdentifier) -> GithubObjectItem? {
+        guard let realm = try? Realm() else {
+            return nil
+        }
+        return realm.object(ofType: GithubObjectItem.self, forPrimaryKey: identifier.rawValue)
+    }
+
     private func create(entryObjects: [EntryObject], parent: NSFileProviderItemIdentifier) -> [NSFileProviderItem] {
         // Because realm cannot pass object between threads, I create items twice for display and for saving.
         let items = { () in

import Result

internal class FileProviderExtension: NSFileProviderExtension {
    // FIXME: make customizable
    private let github: GithubClient = GithubClient(token: "f0b36f49b425c2dcac0bdc64305da04db6ff23c0")
    private let repositories: [(String, String)] = [
        ("mzp", "LoveLiver"),


    var fileManager: FileManager = FileManager()

    // MARK: - URL

    override func urlForItem(withPersistentIdentifier identifier: NSFileProviderItemIdentifier) -> URL? {
        guard let item = self.findItem(for: identifier) else {
