public static CommandJson of(Command command, ObjectMapper objectMapper) {
Function<Object, JsonNode> serialiser = objectMapper::valueToTree;
return of(
command.getAggregateId().getType(),
command.getAggregateId().getId(),
command.getCommandName().getName(),
command.getCommandName().getVersion(),
command.getCommandTimestamp().getTimestamp().toEpochMilli(),
command.getCommandTimestamp().getStreamId(),
command.getProcessingId().map(UUID::toString).orElse(""),
command.getParameters().serialise(serialiser)
);
}