@Override
  public List<OperatingCost> getOperatingCostByTruckByMonth(Truck truck, Date month) {
    List<OperatingCost> operatingCosts = repository.getOperatingCostByTruckByMonth(truck, month);
    //        Collections.sort(operatingCosts);
    return operatingCosts;

    //        boolean found = false;
    //        boolean isTrigger = false;
    //        List<OperatingCost> operatingCosts = new ArrayList<>();
    //        final DateTimeFormatHelper dateTimeFormatHelper = new DateTimeFormatHelper();
    //        List<OperatingCost> operatingCostList = new ArrayList<>();
    //
    //        Truck truckk = null;
    //        if (truck.getId() != null) {
    //            truckk = truckRepository.findOne(truck.getId());
    //        }
    //
    //        if (truckk != null) {
    //            operatingCostList.addAll(truckk.getOperatingCosts());
    //        }
    //
    //        String filteredMonthNumber = dateTimeFormatHelper.getMonthNumber(month);
    //        String filteredYearNumber = dateTimeFormatHelper.getYearNumber(month);
    //
    //        for (OperatingCost operatingCost : operatingCostList) {
    //            if
    // (dateTimeFormatHelper.getMonthNumber(operatingCost.getTransactionDate()).equalsIgnoreCase(filteredMonthNumber)
    //                    &&
    // dateTimeFormatHelper.getYearNumber(operatingCost.getTransactionDate()).equalsIgnoreCase(filteredYearNumber)) {
    //                operatingCosts.add(operatingCost);
    //            }
    //        }
    //        Collections.sort(operatingCosts);
    //        return operatingCosts;
  }
 @Override
 public OperatingCost findById(String id) {
   try {
     return repository.findOne(id);
   } catch (IllegalArgumentException iaEx) {
     return null;
   }
 }
 @Override
 public List<OperatingCost> getOperatingCostByTruckBetweenTwoDates(
     Truck truck, Date from, Date to) {
   List<OperatingCost> operatingCosts =
       repository.getOperatingCostByTruckBetweenTwoDates(truck, from, to);
   //        Collections.sort(operatingCosts);
   return operatingCosts;
 }
  @Override
  public List<OperatingCost> getOperatingCostBtnTwoDates(Date start, Date end) {
    return repository.findOperatingCostBetweenTwoDates(start, end);

    //        DateTimeFormatHelper dateTimeFormatHelper = new DateTimeFormatHelper();
    //        Date resetStartDate = dateTimeFormatHelper.resetTimeAndMonthStart(start);
    //        Date resetEndDate = dateTimeFormatHelper.resetTimeAndMonthEnd(end);

    //        List<OperatingCost> operatingCostList = new ArrayList<>();
    ////        List<OperatingCost> allOperatingCostList = findAll();
    ////
    ////        for (OperatingCost operatingCost : allOperatingCostList) {
    ////            Date transactionDate =
    // dateTimeFormatHelper.resetTimeOfDate(operatingCost.getTransactionDate());
    ////            if (transactionDate.compareTo(resetStartDate) == 0 ||
    // transactionDate.compareTo(resetEndDate) == 0 || (transactionDate.after(resetStartDate) &&
    // transactionDate.before(resetEndDate))) {
    ////                operatingCostList.add(operatingCost);
    ////            }
    ////        }
    //        return operatingCostList;
  }
 @Override
 public void delete(OperatingCost truck) {
   repository.delete(truck);
 }
 @Override
 public void merge(OperatingCost truck) {
   if (truck.getId() != null) {
     repository.save(truck);
   }
 }
 @Override
 public void persist(OperatingCost truck) {
   repository.save(truck);
 }
 @Override
 public List<OperatingCost> findAll() {
   return ImmutableList.copyOf(repository.findAll(sortByTransactionDate()));
 }