   }
   
   @IBAction func save(sender: NSButton) {
-    closeWindow()
+    if saveInvoice() {
+      closeWindow()
+    }
   }
   
   @IBAction func cancel(sender: NSButton) {

    
    itemsTable.setDelegate(self)
    itemsTable.setDataSource(self)
  }
  
  // MARK: - private
  
  private func addEmptyItem() {
    items.append(InvoiceItem())

    return (from, to)
  }
  
  private func saveInvoice() -> Bool {
    let invoice = Invoice()
    invoice.number = numberField.stringValue
    invoice.issueDate = issueDateField.dateValue
    
    
    return true
  }
  
  // MARK: - IBAction
  
  @IBAction func cellValueChanged(sender: NSTextField) {
