public async Task <ActionResult <Applicant> > PutApplicant(int id, Applicant applicant) { if (id != applicant.ID) { return(BadRequest("Data not Matching")); } try { _logger.LogInformation($"Verifying {applicant.CountryOfOrigin} is a valid CountryOfOrigin::: @ {DateTimeOffset.Now}"); await _verifyOrigin.verifyCountryOfOrigin(applicant.CountryOfOrigin); } catch { _logger.LogError($"Invalid CountryOfOrigin: Applicant with ID: {id} tried to use \"{applicant.CountryOfOrigin}\" as CountryOfOrigin::: @ {DateTimeOffset.Now}"); return(BadRequest("Invalid CountryOfOrigin")); } try { _logger.LogInformation($"Updating Applicant with ID: {id}::: @ {DateTimeOffset.Now}"); await _viewModel.PutApplicant(id, applicant); _logger.LogInformation($"Applicant Update Successful::: @ {DateTimeOffset.Now}"); } catch (DbUpdateConcurrencyException) { if (!_viewModel.ApplicantExists(id)) { _logger.LogError($"Applicant with ID: {id} does not Exist::: @ {DateTimeOffset.Now}"); return(NotFound()); } else { throw; } } return(await GetApplicant(id)); }