class EuGrantTransferServiceImpl implements EuGrantTransferService {

    @Override
    @Transactional
    public ServiceResult<Void> uploadGrantAgreement(String contentType, String contentLength, String originalFilename, long applicationId, HttpServletRequest request) {
        return findGrantTransferByApplicationIdCreateIfNotExists(applicationId).andOnSuccess(grantTransfer ->
                fileControllerUtils.handleFileUpload(contentType, contentLength, originalFilename, fileValidator, validMediaTypes, maxFileSize, request,
                        (fileAttributes, inputStreamSupplier) -> fileService.createFile(fileAttributes.toFileEntryResource(), inputStreamSupplier)
                                .andOnSuccessReturnVoid(created ->
                                        grantTransfer.setGrantAgreement(created.getRight())
                                )).toServiceResult());
    }

}