     //MARK: - View controller navigation
     
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
-        if segue.identifier == Constants.Identifiers.showJobSegue, let row = sender as? Int, let dest = segue.destination as? JobViewController{
+        if segue.identifier == Constants.Identifiers.showJobSegue, let row = sender as? Int{
+            prepareViewController(viewController: segue.destination, row: row, type: .job)
+        }
+        else if segue.identifier == Constants.Identifiers.showBuildSegue, let row = sender as? Int{
+            prepareViewController(viewController: segue.destination, row: row, type: .build)
+        }
+    }
+    
+    func prepareViewController(viewController: UIViewController, row: Int, type: Favorite.FavoriteType){
+        if type == .job, let dest = viewController as? JobViewController{
             dest.job = jobs[row].job
             dest.account = jobs[row].account
         }
-        else if segue.identifier == Constants.Identifiers.showBuildSegue, let row = sender as? Int, let dest = segue.destination as? BuildViewController{
+        else if type == .build, let dest = viewController as? BuildViewController{
             dest.build = builds[row].build
             dest.account = builds[row].account
         }

        super.viewDidLoad()
        loadJobs()
        loadBuilds()
    }
    
    //MARK: - Data loading and presentation

        
        return cell
    }
}

extension FavoritesTableViewController: UIViewControllerPreviewingDelegate{
    func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
        navigationController?.pushViewController(viewControllerToCommit, animated: true)
    }
    
    func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
        if let indexPath = tableView.indexPathForRow(at: location){
            previewingContext.sourceRect = tableView.rectForRow(at: indexPath)
            
            let appDelegate = UIApplication.shared.delegate as? AppDelegate
            
            if indexPath.section == 0{
                guard let viewController = appDelegate?.getViewController(name: "JobViewController")
                    else { return nil }
                prepareViewController(viewController: viewController, row: indexPath.row, type: .job)
                return viewController
                
            }
            else if indexPath.section == 1{
                guard let viewController = appDelegate?.getViewController(name: "BuildViewController")
                    else { return nil }
                prepareViewController(viewController: viewController, row: indexPath.row, type: .build)
                return viewController
            }
            return nil
        }
        return nil
    }
}
