public async Task <ResponseModel> UpdateAsync(Applicant applicant)
        {
            var existingApplicant = await applicantRepository.FindByIdAsync(applicant.ID);

            if (existingApplicant == null)
            {
                return new ResponseModel {
                           Success = false, Message = "Applicant not exisit", StatusCode = 400
                }
            }
            ;

            var validationResult = new Validator.ApplicantValidator().Validate(applicant);

            if (!validationResult.IsValid)
            {
                return new ResponseModel {
                           Success = false, Message = validationResult.ToString(" Error:"), StatusCode = 400
                }
            }
            ;

            existingApplicant.Name            = applicant.Name;
            existingApplicant.Address         = applicant.Address;
            existingApplicant.Age             = applicant.Age;
            existingApplicant.CountryOfOrigin = applicant.CountryOfOrigin;
            existingApplicant.EMailAddress    = applicant.EMailAddress;
            existingApplicant.FamilyName      = applicant.FamilyName;
            existingApplicant.Hired           = applicant.Hired;

            try
            {
                applicantRepository.Update(existingApplicant);

                await unitOfWork.CompleteAsync();

                return(new ResponseModel {
                    Success = true, Message = "Applicant updated successfully", Data = applicant, StatusCode = 200
                });
            }
            catch (Exception ex)
            {
                // Do some logging stuff
                return(new ResponseModel {
                    Message = $"An error occurred when updating the product: {ex.Message}", Success = false, StatusCode = 400
                });
            }
        }
    }
}
        public async Task <ResponseModel> SaveAsync(Applicant applicant)
        {
            try
            {
                if (applicant == null)
                {
                    return new ResponseModel {
                               Success = false, Message = "Invalid applicant", StatusCode = 400
                    }
                }
                ;

                var validationResult = new Validator.ApplicantValidator().Validate(applicant);
                if (!validationResult.IsValid)
                {
                    return new ResponseModel {
                               Success = false, Message = validationResult.ToString(" Error:"), StatusCode = 400
                    }
                }
                ;

                await applicantRepository.AddAsync(applicant);

                await unitOfWork.CompleteAsync();

                return(new ResponseModel {
                    Success = true, Message = "Successfully added new applicant", StatusCode = 201
                });
            }
            catch (Exception ex)
            {
                // Do some logging stuff
                return(new ResponseModel {
                    Message = $"An error occurred when saving the applicant: {ex.Message}", Success = false
                });
            }
        }