final Client client = this.clientRepository.findOneWithNotFoundDetection(resourceId);
final Note noteForUpdate = this.noteRepository.findByClientIdAndId(resourceId, noteId);
if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); }
final Map<String, Object> changes = noteForUpdate.update(command);
if (!changes.isEmpty()) {
this.noteRepository.saveAndFlush(noteForUpdate);
}