@Autowired private Bus bus;
public Customer create(VersionedId customerId, CustomerInfo info, double initialAccountBalance) {
List<ValidationError> errors = new ArrayList<ValidationError>();
if (StringUtils.isBlank(info.getName())) {
errors.add(new ValidationError("customer name is required"));
}
if (initialAccountBalance < 10.0) {
errors.add(new ValidationError("minimum account balance is 10.00"));
}
if (errors.isEmpty()) {
return new Customer(customerId, info, initialAccountBalance);
} else {
bus.reply(errors);