public async Task <GetPolicyViewModel> UpdatePolicyAsync(Guid id, PolicyViewModel policyViewModel) { var policy = await _policyRepository.FetchByIdAsync(id); if (policy != null) { _logger.LogInformation($"Policy found for an update - id: {id}"); policy.HasMedicalHistory = policyViewModel.HasMedicalHistory; policy.IsSmoker = policyViewModel.IsSmoker; var updatedPolicy = await _policyRepository.UpdateByIdAsync(policy.Id, policy); _logger.LogInformation($"Policy has been updated - id: {id}"); return(_mapper.Map <GetPolicyViewModel>(updatedPolicy)); } return(null); }