     }
     
     func filterContentForSearchText(searchText: String, scope: String = "All") {
-        filteredPasswordsTableEntries = passwordsTableEntries.filter { entry in
-            return entry.title.lowercased().contains(searchText.lowercased())
-        }
-        if searchController.isActive && searchController.searchBar.text != "" {
-            reloadTableView(data: filteredPasswordsTableEntries)
-        } else {
-            reloadTableView(data: passwordsTableEntries)
-        }
+        switch scope {
+        case "All":
+            filteredPasswordsTableEntries = passwordsTableAllEntries.filter { entry in
+                return entry.title.lowercased().contains(searchText.lowercased())
+            }
+            if searchController.isActive && searchController.searchBar.text != "" {
+                reloadTableView(data: filteredPasswordsTableEntries)
+            } else {
+                reloadTableView(data: passwordsTableAllEntries)
+            }
+        case "Current":
+            filteredPasswordsTableEntries = passwordsTableEntries.filter { entry in
+                return entry.title.lowercased().contains(searchText.lowercased())
+            }
+            if searchController.isActive && searchController.searchBar.text != "" {
+                reloadTableView(data: filteredPasswordsTableEntries)
+            } else {
+                reloadTableView(data: passwordsTableEntries)
+            }
+        default:
+            break
+        }
+        
+        
     }
     
     private func reloadTableView(data: [PasswordsTableEntry], anim: CAAnimation? = nil) {

    
    private func initPasswordsTableEntries(parent: PasswordEntity?) {
        passwordsTableEntries.removeAll()
        filteredPasswordsTableEntries.removeAll()
        var passwordEntities = [PasswordEntity]()
        if Defaults[.isShowFolderOn] {
            passwordEntities = self.passwordStore.fetchPasswordEntityCoreData(parent: parent)
        } else {
            passwordEntities = self.passwordStore.fetchPasswordEntityCoreData(withDir: false)
        }
        passwordsTableEntries = passwordEntities.map {
            PasswordsTableEntry(title: $0.name!, isDir: $0.isDir, passwordEntity: $0)
        }
        parentPasswordEntity = parent

            backAction(self)
        }
    }
    func searchBar(_ searchBar: UISearchBar, selectedScopeButtonIndexDidChange selectedScope: Int) {
        updateSearchResults(for: searchController)
    }
    
    func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
        searchController.searchBar.selectedScopeButtonIndex = 0
        updateSearchResults(for: searchController)
    }
}

extension PasswordsViewController: UISearchResultsUpdating {
    func updateSearchResults(for searchController: UISearchController) {
        var scope = "All"
        if let scopeButtonTitles = searchController.searchBar.scopeButtonTitles {
            scope = scopeButtonTitles[searchController.searchBar.selectedScopeButtonIndex]
        }
        filterContentForSearchText(searchText: searchController.searchBar.text!, scope: scope)
    }
}
