public async Task <Result <PersonContact> > Handle(UpdatePersonContactCommand request, CancellationToken cancellationToken) { using (_unitOfWork) { try { PersonContact personContact = new PersonContact(); RegisterPersonService registerPersonService = new RegisterPersonService(_unitOfWork); var personContactList = await registerPersonService.GetPersonContact(request.PersonId); if (personContactList.Count > 0) { personContact = await registerPersonService.UpdatePersonContact(request.PersonId, request.PhysicalAddress, request.MobileNumber); } else { personContact = await registerPersonService.addPersonContact(request.PersonId, request.PhysicalAddress, request.MobileNumber, request.AlternativeNumber, request.EmailAddress, request.UserId); } return(Result <PersonContact> .Valid(personContact)); } catch (Exception e) { Log.Error(e.Message); return(Result <PersonContact> .Invalid(e.Message)); } } }