public List<StatisticDetailsBean> getContactUsStatisticData(Date from, Date to) { List<StatisticDetailsBean> results = new ArrayList<StatisticDetailsBean>(); List<ContactUs> contacts = contactUsRepo.findInDateRange(from, to); StatisticDetailsBean contactDetailsBean = null; for (ContactUs c : contacts) { contactDetailsBean = new StatisticDetailsBean(c.getContactId(), c.getName(), c.getEmail(), c.getCreatedDate()); results.add(contactDetailsBean); } return results; }