class TransactionResource {

    @ApiOperation(value = "Send private transaction payload")
    @ApiResponses({
        @ApiResponse(code = 200, response = SendResponse.class, message = "Send response"),
        @ApiResponse(code = 400, message = "For unknown and unknown keys")
    })
    @POST
    @Path("send")
    @Consumes(APPLICATION_JSON)
    @Produces(APPLICATION_JSON)
    public Response send(
            @ApiParam(name = "sendRequest", required = true) @NotNull @Valid
                    final SendRequest sendRequest)
            throws UnsupportedEncodingException {

        Base64.Decoder base64Decoder = Base64.getDecoder();

        PublicKey sender = Optional.ofNullable(sendRequest.getFrom())
            .map(base64Decoder::decode)
            .map(PublicKey::from)
            .orElseGet(transactionManager::defaultPublicKey);

        final List<PublicKey> recipientList =
            Stream.of(sendRequest)
                .filter(sr -> Objects.nonNull(sr.getTo()))
                .flatMap(s -> Stream.of(s.getTo()))
                .map(base64Decoder::decode)
                .map(PublicKey::from)
                .collect(Collectors.toList());

        com.quorum.tessera.transaction.SendRequest request = com.quorum.tessera.transaction.SendRequest.Builder.create()
            .withRecipients(recipientList)
            .withSender(sender)
            .withPayload(sendRequest.getPayload())
            .build();

        final com.quorum.tessera.transaction.SendResponse response = transactionManager.send(request);

        final String encodedKey =
                Optional.of(response)
                        .map(com.quorum.tessera.transaction.SendResponse::getTransactionHash)
                        .map(MessageHash::getHashBytes)
                        .map(Base64.getEncoder()::encodeToString)
                        .get();

        final SendResponse sendResponse =
                Optional.of(response)
                        .map(com.quorum.tessera.transaction.SendResponse::getTransactionHash)
                        .map(MessageHash::getHashBytes)
                        .map(Base64.getEncoder()::encodeToString)
                        .map(SendResponse::new)
                        .get();

        final URI location =
                UriBuilder.fromPath("transaction")
                        .path(URLEncoder.encode(encodedKey, StandardCharsets.UTF_8.toString()))
                        .build();

        return Response.status(Status.CREATED).type(APPLICATION_JSON).location(location).entity(sendResponse).build();
    }

    public  TransactionResource(TransactionManager transactionManager);

}