     private var searchBar: UISearchBar?
 
     var isSearchBarVisible = false
+    var isSearching = false
 
     lazy private var statusBarHeight: CGFloat = {
         return UIApplication.sharedApplication().statusBarFrame.height

    }
   
    func cancelSearchReposition(searchBar: UISearchBar, animated: Bool) {
        searchBar.text = nil
        searchBar.setShowsCancelButton(false, animated: animated)

        UIView.animateWithDuration(animated ? accurateAnimationDuration : 0,
            animations: {
                if let navigationBar = self.navigationController?.navigationBar where navigationBar.frame.origin.y < 0 {
                    navigationBar.frame.origin.y = self.statusBarHeight
                }
                
                let top = self.topItemOffset - self.searchBarHeight
                
                self.decksCollectionView.contentInset = UIEdgeInsets(top: -top, left: 0, bottom: 0, right: 0)
                self.decksCollectionView.contentOffset.y = top
                searchBar.frame = CGRect(x: 0, y: self.navbarHeight + self.statusBarHeight, width: searchBar.frame.width, height: self.searchBarHeight)
            }, completion: { _ in
                if let rootVC = UIApplication.sharedRootViewController as? SBDrawerController {
                    rootVC.openDrawerGestureModeMask = .Custom
                }
                self.decksCollectionView.reloadData()
            }
        )
    }

    func startSearchReposition(searchBar: UISearchBar, animated: Bool) {

        searchDecks = nil
        
        if let rootVC = UIApplication.sharedRootViewController as? SBDrawerController {
            rootVC.openDrawerGestureModeMask = .None
        }
        
        searchBar.text = nil
        searchBar.setShowsCancelButton(true, animated: animated)
        
        UIView.animateWithDuration(animated ? accurateAnimationDuration : 0,
            animations: {
                if let navigationBar = self.navigationController?.navigationBar {
                    
                    self.decksCollectionView.contentInset = UIEdgeInsets(top: self.searchBarHeight + self.statusBarHeight + self.marginValue * 2, left: 0, bottom: 0, right: 0)

                    navigationBar.frame.origin.y = -self.navbarHeight
                    
                    searchBar.frame.origin.y = 0
                    searchBar.frame.size.height = self.statusBarHeight + self.searchBarHeight + self.marginValue
                    searchBar.layoutIfNeeded()
                    self.view.layoutIfNeeded()
                    
                }
            },
            completion: nil
        )
    }

    func searchBar(searchBar: UISearchBar, textDidChange searchText: String) {

        }
    }
    
    func searchBarSearchButtonClicked(searchBar: UISearchBar) {
        hideKeyboard()
    }
    
    func hideKeyboard() {
        searchBar?.resignFirstResponder()
    }
    
    func hideSearchBar(top:CGFloat) {
        
        if isSearchBarVisible {
        
            isSearchBarVisible = false
            hideKeyboard()
            

            UIView.animateWithDuration(softAnimationDuration, delay: 0, options: .CurveEaseOut,
                animations: {
