             aCoder.encodeObject(movie.releaseYear, forKey: "releaseYear")
         }
     }
+    
+    static func path() -> String {
+        let documentsPath = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true).first
+        let path = documentsPath?.stringByAppendingString("/Movie")
+        return path!
+    }
 }
 
 //External functions that trigger Archiving and Unarchiving of Movie

    
    required convenience init?(coder aDecoder: NSCoder) {
        self.init()

        if let name = aDecoder.decodeObjectForKey("name") as? String,
            director = aDecoder.decodeObjectForKey("director") as? String,
            releaseYear = aDecoder.decodeObjectForKey("releaseYear") as? Int {
            movie = Movie(name: name, director: director, releaseYear: releaseYear)
        }
    }
    

func archiveMovie(movie: Movie) {
    let movieClassObject = MovieClass()
    movieClassObject.movie = movie
    NSKeyedArchiver.archiveRootObject(movieClassObject, toFile: MovieClass.path())
}

func unarchiveMovie() -> Movie? {
    let movieClassObject = NSKeyedUnarchiver.unarchiveObjectWithFile(MovieClass.path()) as? MovieClass
    return movieClassObject?.movie
}

// MARK: - Test

let avatar = Movie(name: "Avatar", director: "James Cameron", releaseYear: 2009)
archiveMovie(avatar)

unarchiveMovie()?.director