             do {
                 try privateMOC.save()
                 self.context.performAndWait {
-                    do {
-                        try self.context.save()
-                    } catch {
-                        fatalError("FailureToSaveContext".localize(error))
-                    }
+                    self.saveUpdatedContext()
                 }
             } catch {
                 fatalError("FailureToSaveContext".localize(error))

        for path in paths {
            let isDir = !path.hasSuffix(".gpg")
            if let passwordEntity = getPasswordEntity(by: path, isDir: isDir) {
                parentPasswordEntity = passwordEntity
                passwordEntity.synced = false
            } else {
                if !isDir {
                    return insertPasswordEntity(name: URL(string: path.stringByAddingPercentEncodingForRFC3986()!)!.deletingPathExtension().lastPathComponent, path: path, parent: parentPasswordEntity, synced: false, isDir: false)
                } else {
                    parentPasswordEntity = insertPasswordEntity(name: URL(string: path.stringByAddingPercentEncodingForRFC3986()!)!.lastPathComponent, path: path, parent: parentPasswordEntity, synced: false, isDir: true)
                }
            }
        }
        return nil
    }
    
    private func insertPasswordEntity(name: String, path: String, parent: PasswordEntity?, synced: Bool = false, isDir: Bool = false) -> PasswordEntity? {
        var ret: PasswordEntity? = nil
        if let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: self.context) as? PasswordEntity {
            passwordEntity.name = name
            passwordEntity.path = path
            passwordEntity.parent = parent
            passwordEntity.synced = synced
            passwordEntity.isDir = isDir
            do {
                try self.context.save()
                ret = passwordEntity
            } catch {
                fatalError("FailedToInsertPasswordEntity".localize(error))
            }
        }
        return ret
    }
    
    public func add(password: Password) throws -> PasswordEntity? {

            let parent = current!.parent
            self.context.delete(current!)
            current = parent
        }
        self.saveUpdatedContext()
    }
    
    public func saveUpdatedContext() {
        do {
            try context.save()
        } catch {
            fatalError("FailureToSaveContext".localize(error))
        }
    }
    
