public void updateClient(String organizationId, String clientId, UpdateClientBean bean)
        throws ClientNotFoundException, NotAuthorizedException {

        tryAction(() -> {
            ClientBean clientForUpdate = getClientFromStorage(organizationId, clientId);
            EntityUpdatedData auditData = new EntityUpdatedData();
            if (AuditUtils.valueChanged(clientForUpdate.getDescription(), bean.getDescription())) {
                auditData.addChange("description", clientForUpdate.getDescription(), bean.getDescription()); //$NON-NLS-1$
                clientForUpdate.setDescription(bean.getDescription());
            }
            if (AuditUtils.valueChanged(clientForUpdate.getImage(), bean.getImage())) {
                auditData.addChange("image", clientForUpdate.getImage(), bean.getImage()); //$NON-NLS-1$
                // As an upload will have happened separately, we need to attach to the blob so that it doesn't get wiped out later.
                // Remove old image
                if (clientForUpdate.getImage() != null) {
                    blobstore.remove(clientForUpdate.getImage());
                }
                // Attach to new image
                clientForUpdate.setImage(bean.getImage());
                if (bean.getImage() != null) {
                    blobstore.attachToBlob(bean.getImage());
                }
            }
            storage.updateClient(clientForUpdate);
            storage.createAuditEntry(AuditUtils.clientUpdated(clientForUpdate, auditData, securityContext));

            LOGGER.debug("Updated client {0}: {1}", clientForUpdate.getName(), clientForUpdate); //$NON-NLS-1$
        });
    }
@author Marc Savy {@literal <marc@blackparrotlabs.io>}
manager/api/rest-impl/src/main/java/io/apiman/manager/api/service/ClientAppService.java