final Long noteId = command.entityId();
final NoteType type = NoteType.LOAN;
final Loan loan = this.loanRepository.findOne(resourceId);
if (loan == null) { throw new LoanNotFoundException(resourceId); }
final Note noteForUpdate = this.noteRepository.findByLoanIdAndId(resourceId, noteId);
if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); }
final Map<String, Object> changes = noteForUpdate.update(command);