public void delete(Receipt receipt) {
    Receipt oldReceipt;
    if ((oldReceipt = verifyNumberIsAvailable(receipt)) != null) {
      em.remove(oldReceipt);
      receiptSearch.currentPage();
    }

    messages
        .info(new DefaultBundleKey("receipt_deleted"))
        .defaults("You have been successfully deleted the receipt {0}!")
        .params(receipt.getCodeReceipt());
  }
 private Receipt verifyNumberIsAvailable(Receipt receipt) {
   Receipt existing = em.find(Receipt.class, receipt.getCodeReceipt());
   return existing;
 }