/**
   * asd.
   *
   * @return asd.
   */
  @Override
  public final List<Sale> findAllSales() {
    logger.debug("SaleServiceImpl.findAllSales starts");

    List<Sale> res = salesDao.find();

    logger.debug("SaleServiceImpl.findAllSales starts");

    return res;
  }
  /**
   * asd.
   *
   * @param sale asd.
   * @param products asd.
   * @param user asd.
   * @param store asd.
   */
  @Override
  @Transactional
  public final void addNewSale(
      Sale sale, final List<Product> products, final User user, final Store store) {

    logger.debug("SaleServiceImpl.addNewSale starts");

    getEntityManager().getTransaction().begin();

    sale.setCreatedAt(new Date());
    sale.setCreator(user);
    sale.setStore(store);
    sale = salesDao.save(sale);

    for (Product p : products) {
      p.setSale(sale);
      productsDao.save(p);
    }

    getEntityManager().getTransaction().commit();
  }
 /** {@inheritDoc} */
 @Override
 public long count() {
   return salesDao.count();
 }