private async Task ContractsClient_PetitionedSignatureResponseReceived(object sender, SignaturePetitionResponseEventArgs e)
 {
     try
     {
         this.OnPetitionedSignatureResponseReceived(e);
     }
     catch (Exception ex)
     {
         this.logService.LogException(ex);
         await this.uiDispatcher.DisplayAlert(AppResources.ErrorTitle, ex.Message);
     }
 }
 private void OnPetitionedPeerReviewIdResponseReceived(SignaturePetitionResponseEventArgs e)
 {
     PetitionedPeerReviewIdResponseReceived?.Invoke(this, e);
 }
 private void OnPetitionedSignatureResponseReceived(SignaturePetitionResponseEventArgs e)
 {
     SignaturePetitionResponseReceived?.Invoke(this, e);
 }
        private async void Contracts_PetitionedPeerReviewResponseReceived(object sender, SignaturePetitionResponseEventArgs e)
        {
            try
            {
                if (!e.Response)
                {
                    await this.uiDispatcher.DisplayAlert(AppResources.PeerReviewRejected, AppResources.APeerYouRequestedToReviewHasRejected, AppResources.Ok);
                }
                else
                {
                    StringBuilder xml = new StringBuilder();
                    tagProfile.LegalIdentity.Serialize(xml, true, true, true, true, true, true, true);
                    byte[] data = Encoding.UTF8.GetBytes(xml.ToString());
                    bool?  result;

                    try
                    {
                        result = this.neuronService.Contracts.ValidateSignature(e.RequestedIdentity, data, e.Signature);
                    }
                    catch (Exception ex)
                    {
                        await this.uiDispatcher.DisplayAlert(AppResources.ErrorTitle, ex.Message);

                        return;
                    }

                    this.uiDispatcher.BeginInvokeOnMainThread(async() =>
                    {
                        if (!result.HasValue || !result.Value)
                        {
                            await this.uiDispatcher.DisplayAlert(AppResources.PeerReviewRejected, AppResources.APeerYouRequestedToReviewHasBeenRejectedDueToSignatureError, AppResources.Ok);
                        }
                        else
                        {
                            (bool succeeded, LegalIdentity legalIdentity) = await this.networkService.TryRequest(() => this.neuronService.Contracts.AddPeerReviewIdAttachment(tagProfile.LegalIdentity, e.RequestedIdentity, e.Signature));
                            if (succeeded)
                            {
                                await this.uiDispatcher.DisplayAlert(AppResources.PeerReviewAccepted, AppResources.APeerReviewYouhaveRequestedHasBeenAccepted, AppResources.Ok);
                            }
                        }
                    });
                }
            }
            catch (Exception ex)
            {
                this.logService.LogException(ex);
                await this.uiDispatcher.DisplayAlert(AppResources.ErrorTitle, ex.Message, AppResources.Ok);
            }
        }