public DocumentScanController()
 {
     contractApi = new ContractApi();
     documentsApi = new DocumentsApi();
     renewaltApi = new RenewalApi();
 }
        private bool IsValidData(out string errMsg)
        {
            var documentsApi = new DocumentsApi();
            var rv = false;
            errMsg = string.Empty;
            var bankValidated = false;

            var bankModel = contractApi.GetBankDetails(0, ContractID, CurrentMerchantID);

            if (!string.IsNullOrEmpty(bankModel.AccountName) && !string.IsNullOrEmpty(bankModel.AccountNumber))
            {
                var doc = documentsApi.RetriveDocument(CurrentMerchantID, ContractID, (int)Pecuniaus.Contract.DocumentTypes.BankStatements);

                if (doc == null || doc.Count == 0)
                {
                    errMsg = "Bank Statement not uploaded.";
                }
                else
                {
                    bankValidated = true;
                }
            }

            var corpValiidated = false;

            if (bankValidated)
            {
                var corpModel = contractApi.GetCorporateDocumemts(ContractID, CurrentMerchantID);
                if (!string.IsNullOrEmpty(corpModel.NameOfCompany) && !string.IsNullOrEmpty(corpModel.RNCNumber))
                {
                    var doc = documentsApi.RetriveDocument(CurrentMerchantID, ContractID, (int)Pecuniaus.Contract.DocumentTypes.LegalDocumentsOfTheCompany);

                    if (doc == null || doc.Count == 0)
                    {
                        errMsg = "Corp Doc. not uploaded.";
                    }
                    else
                    {
                        corpValiidated = true;
                    }

                }

            }
            var commValidated = false;

            if (corpValiidated)
            {
                var commercialModel = contractApi.GetCommercialNameVerification(ContractID, CurrentMerchantID);
                if (!string.IsNullOrEmpty(commercialModel.BusinessName))
                {
                    var doc = documentsApi.RetriveDocument(CurrentMerchantID, ContractID, (int)Pecuniaus.Contract.DocumentTypes.CommercialNameVerificationScreenshot);

                    if (doc == null || doc.Count == 0)
                    {
                        errMsg = "Commertial Name Doc. not uploaded.";
                    }
                    else
                    {
                        commValidated = true;
                    }

                }
            }
            if (commValidated)
            {
                var llModel = contractApi.GetLandLordVerification(ContractID, CurrentMerchantID);
                if (llModel.MerchantDetails.RentFlag == 200001)
                {
                    if (string.IsNullOrEmpty(llModel.ScriptFile))
                    {
                        errMsg = "Landlord Script file not uploaded.";

                    }
                    else
                    {
                        rv = true;
                    }
                }
                else
                {
                    rv = true;
                }

            }
            return rv;
        }