public async Task <InstanceSettingsDto> GetEntityByInstanceIdAsync(Guid clientId) { var entity = await _repository.GetEntityByInstanceIdAsync(clientId); if (entity == null) { throw new NotFoundException(); } return(_mapper.Map <InstanceSettings, InstanceSettingsDto>(entity)); }