public Offer postOffer( String title, String description, String location, String url, Integer companyId) { Validate.isTrue( companyService.exists(companyId), "Company with Id=" + companyId + " does not exist"); Offer offer = new Offer(); offer.setTitle(normalize(title)); offer.setDescription(normalize(description)); offer.setLocation(normalize(location)); offer.setUrl(normalize(url)); offer.setPublicationDate(new Date()); offer.setUpdated(new Date()); offer.setCompanyId(companyId); try { offerDAO.create(offer); return offer; } catch (DataIntegrityViolationException e) { throw new IllegalArgumentException("Cannot create offer with given parameters", e); } }