     }
 
     self.adjustColumnWidth(for: fileBrowserItem.children, outlineViewLevel: level)
-    return fileBrowserItem.children.filter({ !$0.fileItem.isHidden })[index]
-  }
-
-  func outlineView(_: NSOutlineView, isItemExpandable item: Any) ->  Bool {
+    return self.prepare(fileBrowserItem.children)[index]
+  }
+
+  func outlineView(_: NSOutlineView, isItemExpandable item: Any) -> Bool {
     guard let fileBrowserItem = item as? FileBrowserItem else {
       return false
     }

    let fileItem = fileBrowserItem.fileItem
    if fileItem.isDir {
      let fileItemChildren = self.fileItemService.fileItemWithChildren(for: fileItem.url)?.children ?? []
      fileBrowserItem.children = fileItemChildren.map(FileBrowserItem.init)
      return fileBrowserItem.children.filter { !$0.fileItem.isHidden }.count
    }

    return 0


// MARK: - NSOutlineViewDataSource
extension FileOutlineView {

  fileprivate func prepare(_ children: [FileBrowserItem]) -> [FileBrowserItem] {
    return children.filter { !$0.fileItem.isHidden }.sorted()
  }

  func outlineView(_: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
    if item == nil {
