public async Task <BonusDto> AddBonusAsync(AddBonusDto model, CancellationToken cancellationToken = default) { if (model is null) { throw new ArgumentNullException("", Resources.ModelIsNull); } VendorDto vendorDto = null; try { vendorDto = await _vendorService.GetVendorByIdAsync(model.CompanyId); } catch { throw new ArgumentException(Resources.VendorFindbyIdError); } if (vendorDto == null) { throw new ArgumentException(Resources.VendorFindbyIdError); } var bonus = _mapper.Map <Bonus>(model); bonus.SetInitialValues(); await _bonusRepository.AddAsync(bonus, cancellationToken); return(_mapper.Map <BonusDto>(bonus)); }