         }
     }
     
-    var manifestPath: String {
-        get {
-            return "./\(path)/Contents/Manifest.plist"
+    func getChapter(name: String) throws -> Chapter {
+        for i in 0..<chapters.count {
+            if chapters[i].name == name {
+                return chapters[i]
+            }
+        }
+        throw NSError.error(description: "Not found")
+    }
+    
+    mutating func add(chapter: Chapter) throws {
+        chapters.append(chapter)
+        do {
+            try writeManifest()
+        } catch {
+            throw error
         }
     }
     

    let deploymentTarget: String
    var chapters: [Chapter]
    
    init(name aName: String, version aVersion: String, contentIdentifier aContentIdentifier: String, contentVersion aContentVersion: String, imageReference anImageReference: String? = nil, deploymentTarget aDeploymentTarget: String) {
        name = aName
        version = aVersion
        contentIdentifier = aContentVersion
        contentVersion = aContentVersion
        imageReference = anImageReference
        deploymentTarget = aDeploymentTarget
        chapters = []
    }
    
    var path: String {

    } catch {
        print(error)
    }
}

main()
