public ActionResult SearchBeneficialOwnershipData(string DUNSNumber, string Country, bool isModalView = false, bool isRefresh = false)
        {
            BeneficialOwnership_Main modal = new BeneficialOwnership_Main();

            ViewBag.isModalView = isModalView;
            if (!string.IsNullOrEmpty(DUNSNumber))
            {
                UXBeneficialOwnershipURLEntity uRLEntity;
                BenificialOwnershipFacade      fac = new BenificialOwnershipFacade(this.CurrentClient.ApplicationDBConnectionString);
                uRLEntity = fac.UXGetBeneficialOwnershipURL(DUNSNumber, Country);
                if (string.IsNullOrEmpty(uRLEntity.AuthToken))
                {
                    modal.Base = new CMPBOSV1_Base();
                    modal.lstBeneficialOwnerRelationships = new List <CMPBOSV1_BeneficialOwnerRelationships>();
                    modal.lstBeneficialOwners             = new List <CMPBOSV1_BeneficialOwners>();
                    return(View(modal));
                }
                if (uRLEntity.EnrichmentExists && !isRefresh)
                {
                    DataSet ds = fac.PreviewBenificialOwnershipData(DUNSNumber);
                    CommonMethod.BenificialOwnershipDataPreview(modal, ds);
                    SessionHelper.BeneficialOwnershipData    = JsonConvert.SerializeObject(modal);
                    SessionHelper.BeneficialOwnershipDataSet = JsonConvert.SerializeObject(ds);
                }
                else
                {
                    Utility.BenificialOwnershipData api = new Utility.BenificialOwnershipData();
                    string  benificialDataResponse      = api.GetBenificialOwnershipData(uRLEntity.EnrichmentURL, uRLEntity.AuthToken);
                    dynamic data = JObject.Parse(benificialDataResponse);
                    if (data != null && uRLEntity.APIFamily.ToLower() == ApiLayerType.Directplus.ToString().ToLower())
                    {
                        if ((data.Message != null && !string.IsNullOrEmpty(data.Message.Value)) || (data.error != null && data.error.errorMessage != null && !string.IsNullOrEmpty(data.error.errorMessage.Value)))
                        {
                            modal.Base = new CMPBOSV1_Base();
                            modal.lstBeneficialOwnerRelationships = new List <CMPBOSV1_BeneficialOwnerRelationships>();
                            modal.lstBeneficialOwners             = new List <CMPBOSV1_BeneficialOwners>();
                            return(View(modal));
                        }
                        else
                        {
                            CompanyFacade cfac = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName);
                            DateTime      transactionTimestamp = Convert.ToDateTime(data.transactionDetail.transactionTimestamp.Value);
                            cfac.ProcessDataForEnrichment(0, uRLEntity.DnBAPIId, DUNSNumber, Country, benificialDataResponse, "", transactionTimestamp, uRLEntity.CredentialId);
                            DataSet ds = fac.PreviewBenificialOwnershipData(DUNSNumber);
                            CommonMethod.BenificialOwnershipDataPreview(modal, ds);
                            SessionHelper.BeneficialOwnershipData    = JsonConvert.SerializeObject(modal);
                            SessionHelper.BeneficialOwnershipDataSet = JsonConvert.SerializeObject(ds);
                        }
                    }
                }
            }
            return(View(modal));
        }