     }
 
     @IBAction func didTapSaveBarButtonItem() {
-        recipientDelegate?.addRecipients(addedRecipients)
-
         self.navigationController?.popViewControllerAnimated(true)
     }
 }

import UIKit
import SingleLineKeyboardResize

protocol RecipientsViewControllerDelegate {
    func addRecipients(recipients: [Recipient])
}

class RecipientViewController: UIViewController {
    @IBOutlet weak var tableView: UITableView!
    @IBOutlet weak var saveBarButtonItem: UIBarButtonItem!
    @IBOutlet weak var searchBar: UISearchBar!
    
    var recipientDelegate: RecipientsViewControllerDelegate?

    var recipients : [Recipient] = [Recipient]()
    var addedRecipients : [Recipient] = [Recipient]()
    
    var recipientSearchController : UISearchController!

    override func viewDidLoad() {
        super.viewDidLoad()
        

        searchBar.returnKeyType = UIReturnKeyType.Done
        
        setupKeyboardNotifcationListenerForScrollView(self.tableView)
        
        navigationController?.delegate = self

    }

    func navigationController(navigationController: UINavigationController, willShowViewController viewController: UIViewController, animated: Bool) {
        if let previewViewController = viewController as? PreviewViewController {
            previewViewController.recipients = addedRecipients
        }
    }
    
    @IBAction func handleSingleTapOnEmptyTableView(tap: UIGestureRecognizer) {
        let point = tap.locationInView(tableView)
        let indexPath = self.tableView.indexPathForRowAtPoint(point)
