+ public Optional<RecipientId> resolveRecipientByNumberOptional(final String number) {
+ final Optional<RecipientWithAddress> byNumber;
+ try (final var connection = database.getConnection()) {
+ byNumber = findByNumber(connection, number);
+ } catch (SQLException e) {
+ throw new RuntimeException("Failed read from recipient store", e);
+ }
+ return byNumber.map(RecipientWithAddress::id);
+ }
+