this.fromApiJsonDeserializer.validateForUnassignStaff(command.json());
final Client clientForUpdate = this.clientRepository.findOneWithNotFoundDetection(clientId);
final Staff presentStaff = clientForUpdate.getStaff();
Long presentStaffId = null;
if (presentStaff == null) { throw new ClientHasNoStaffException(clientId); }
presentStaffId = presentStaff.getId();
final String staffIdParamName = ClientApiConstants.staffIdParamName;
if (!command.isChangeInLongParameterNamed(staffIdParamName, presentStaffId)) {
clientForUpdate.unassignStaff();
}
this.clientRepository.saveAndFlush(clientForUpdate);