public Optional<Command> toCommand(CommandTypeMatcher typeMatcher, ObjectMapper objectMapper) {
CommandType commandType = getCommandType();
BiFunction<JsonNode, Type, Object> deserialiser = makeDeserialiser(objectMapper);
return typeMatcher.match(commandType).map(typeInfo ->
commandType.makeCommand(
aggregateId,
StreamTimestamp.of(streamId, Instant.ofEpochMilli(commandTimestamp)),
typeInfo.getTupleSchema().deserialise(deserialiser, parameters),
typeInfo.getReturnType()
))
.map(command -> processingId.isEmpty() ? command : command.processed(UUID.fromString(processingId))
);
}