public CommandProcessingResult create(final JsonCommand command) {
try {
this.validator.validateForCreate(command.json());
final SmsMessage message = this.assembler.assembleFromJson(command);
// TODO: at this point we also want to fire off request using third
// party service to send SMS.
// TODO: decision to be made on wheter we 'wait' for response or use
// 'future/promise' to capture response and update the SmsMessage
// table
this.repository.save(message);
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.withEntityId(message.getId()) //
.build();
} catch (final DataIntegrityViolationException dve) {
handleDataIntegrityIssues(command, dve);
return CommandProcessingResult.empty();
}