public void MoveContactAsync()
        {
            Common    common        = new Common();
            Ontraport op            = new Ontraport();
            var       hubspotFields = Ontraport.hubspotField;
            var       properties    = new StringBuilder();

            foreach (var _hubField in hubspotFields)
            {
                properties.Append($"&property={_hubField}");
            }

            if (properties.Length == 0)
            {
                properties.Append($"&property=firstname&property=lastname&property=email");
            }

            //get batchwise contacts from hubspot
            {
                long totalProcessed = 0;
                long batchID        = 1;
                int  successful     = 0;
                int  failed         = 0;
                var  entity         = "CONTACT";
                var  module         = "Contacts";
                try
                {
                    var    hasMore   = true;
                    var    vidOffset = 0;
                    var    strUrl    = string.Empty;
                    JArray arr       = null;

                    while (hasMore)
                    {
                        strUrl = $"{HubspotBaseUrl}/contacts/v1/lists/all/contacts/all?hapikey={HubspotAppKey}&count=100&vidOffset={vidOffset}{properties}";
                        var jRes = Common.GetApiResult(strUrl, entity);

                        var response = GetHBAPIError(jRes, strUrl, entity);
                        if (!response)
                        {
                            break;
                        }

                        //var jr = JsonReader.ParseObject(jRes);
                        JObject jr = JObject.Parse(jRes);
                        arr = (JArray)jr["contacts"];
                        var vOffset = jr["vid-offset"];
                        var hasrecs = jr["has-more"].ToString();

                        vidOffset = Convert.ToInt32(vOffset.ToString());
                        hasMore   = Convert.ToBoolean(hasrecs.ToString());

                        //get contacts of 100 batchsize

                        if (arr.Count > 0)
                        {
                            ErrorLog.InfoMessage($"Total Contact in Hubspot {arr.Count} in Batch : {batchID}.");
                            Console.WriteLine($"Total Contact in Hubspot {arr.Count} in Batch : {batchID}.");
                            int counter = 1;
                            foreach (JObject JRecord in arr)
                            {
                                Console.WriteLine("__________________________________________");
                                Console.WriteLine($"Process started for contact {counter}.");

                                ErrorLog.InfoMessage($"------------------------------------------------------------------");
                                ErrorLog.InfoMessage($"----------- Details on {DateTime.Now.ToString()} -----------------");
                                ErrorLog.InfoMessage($"Process started for contact {counter}.");

                                JObject contactRec = JRecord;
                                var     contactId  = contactRec["vid"].ToString();
                                var     contProp   = (JObject)contactRec["properties"];

                                /*
                                 * //for testing purpose, after testing need to remove initialization of jsonarray
                                 * //var ja = new JArray();
                                 * contactId = "999051";
                                 * var urlContact = HubspotBaseUrl + "/contacts/v1/contact/vid/" + contactId + "/profile?hapikey=" + HubspotAppKey;
                                 * var jContact = Common.GetApiResult(urlContact, entity);
                                 * var jContResult = JObject.Parse(jContact);
                                 * var contProp = (JObject)jContResult["properties"];
                                 */

                                //get engagements based on single contact id
                                // if engagement has attachment then get attachment Id
                                var ja = GetEntityEngagements(entity, contactId);
                                ErrorLog.InfoMessage($" {ja.Count} engagements found for contact {counter}.");
                                Console.WriteLine($" {ja.Count} engagements found for contact {counter}.");

                                var googleUploadedJA = new JArray();
                                foreach (JObject _ja in ja)
                                {
                                    var fileDetailJo = _ja["filedetails"];
                                    var _fileDetails = new JObject();
                                    var hasResult    = fileDetailJo.IsNullOrEmpty();
                                    if (!hasResult)
                                    {
                                        _fileDetails = (JObject)fileDetailJo;
                                    }
                                    if (_fileDetails != null && _fileDetails.Count > 0)
                                    {
                                        var uploadedResp = common.MoveHubspotDataToGoogleAsync(_fileDetails);
                                        if (uploadedResp != null && uploadedResp["webViewLink"].ToString() == "")
                                        {
                                            if (uploadedResp["message"].ToString() == "")
                                            {
                                                ErrorLog.InfoMessage($"File is not successfully uploaded on Google drive");
                                                Common.Output("File is not successfully uploaded on Google drive");
                                            }
                                            else
                                            {
                                                ErrorLog.InfoMessage($"File is not successfully uploaded on Google drive due to : {uploadedResp["message"].ToString()}");
                                                Common.Output($"File is not successfully uploaded on Google drive due to : {uploadedResp["message"].ToString()}");
                                            }
                                        }
                                        googleUploadedJA.Add(uploadedResp);
                                    }
                                }
                                //for create contact in Ontraport
                                var hasCreated = op.CreateEntity(contProp, contactId, ja, module, googleUploadedJA);
                                if (hasCreated)
                                {
                                    successful++;
                                }
                                else
                                {
                                    failed++;
                                }

                                counter++;
                            }
                            batchID++;
                            totalProcessed += counter;
                        }
                        else
                        {
                            ErrorLog.InfoMessage($" Total Contact in Hubspot {arr.Count} in Batch {batchID}");
                            Console.WriteLine($" Total Contact in Hubspot {arr.Count} in Batch {batchID}");
                        }
                    }
                }
                catch (Exception ex)
                {
                    ErrorLog.WriteLogFile(ex.Message, "Catch Exception", entity);
                }

                Console.WriteLine("__________________________________________");
                Console.WriteLine($"Total Contact Processed : {totalProcessed}");
                Console.WriteLine($"Contact Created Successfully Count : {successful}");
                Console.WriteLine($"Contact Creation Failed Count : {failed}");
                Console.WriteLine("__________________________________________");

                ErrorLog.InfoMessage($"Total Contact Processed : {totalProcessed} and Contact Created Successfully Count : {successful} and Contact Creation Failed Count : {failed}");
            }
        }
        public void MoveDealAsync()
        {
            Common    common = new Common();
            Ontraport op     = new Ontraport();

            op.populateDealField();
            var hubspotDealFields = Ontraport.hubspotDealField;
            var dealProperties    = new StringBuilder();

            foreach (var _hubField in hubspotDealFields)
            {
                dealProperties.Append($"&properties={_hubField}");
            }

            if (dealProperties.Length == 0)
            {
                dealProperties.Append($"&properties=dealname&properties=amount");
            }

            var  totalProcessed = 0;
            long batchID        = 1;
            int  successful     = 0;
            int  failed         = 0;
            var  errorLogJA     = new JArray();
            var  entity         = "DEAL";
            var  module         = "Deals";

            try
            {
                var    hasMore   = true;
                var    vidOffset = 0;
                var    strUrl    = string.Empty;
                JArray arr       = null;

                while (hasMore)
                {
                    strUrl = $"{HubspotBaseUrl}/deals/v1/deal/paged?hapikey={HubspotAppKey}&count=100&offset={vidOffset}{dealProperties}";
                    var jRes     = Common.GetApiResult(strUrl, entity);
                    var response = GetHBAPIError(jRes, strUrl, entity);
                    if (!response)
                    {
                        break;
                    }

                    var jr = JObject.Parse(jRes);
                    arr = (JArray)jr["deals"];
                    var vOffset = jr["offset"];
                    var hasrecs = jr["hasMore"].ToString();
                    vidOffset = Convert.ToInt32(vOffset.ToString());
                    hasMore   = Convert.ToBoolean(hasrecs.ToString());

                    //get contacts of 100 batchsize
                    if (arr.Count > 0)
                    {
                        ErrorLog.InfoMessage($"Total Deals in Hubspot {arr.Count} in Batch : {batchID}");
                        Console.WriteLine($"Total Deals in Hubspot {arr.Count} in Batch : {batchID}");

                        int counter = 1;
                        foreach (var JRecord in arr)
                        {
                            Console.WriteLine("__________________________________________");
                            Console.WriteLine($"Process started for Deal {counter}");

                            ErrorLog.InfoMessage($"------------------------------------------------------------------");
                            ErrorLog.InfoMessage($"----------- Details on {DateTime.Now.ToString()} -----------------");
                            ErrorLog.InfoMessage($"Process started for Deal {counter}");

                            bool    hasCreated = false;
                            JObject dealRec    = (JObject)JRecord;
                            var     dealId     = dealRec["dealId"].ToString();
                            var     dealProp   = (JObject)dealRec["properties"];

                            //get engagements based on single contact id
                            // if engagement has attachment then get attachment Id

                            //var ja = new JArray();

                            var ja = GetEntityEngagements(entity, dealId);
                            ErrorLog.InfoMessage($"{ja.Count} engagements found for Deal {counter}");
                            Console.WriteLine($"{ja.Count} engagements found for Deal {counter}");

                            var googleUploadedJA = new JArray();
                            foreach (JObject _ja in ja)
                            {
                                var fileDetailJo   = _ja["filedetails"];
                                var _fileDetails   = new JObject();
                                var hasFileDetails = _fileDetails.IsNullOrEmpty();
                                if (!hasFileDetails)
                                {
                                    _fileDetails = (JObject)fileDetailJo;
                                }
                                if (_fileDetails != null && _fileDetails.Count > 0)
                                {
                                    var uploadedResp = common.MoveHubspotDataToGoogleAsync(_fileDetails);
                                    if (uploadedResp != null && uploadedResp["webViewLink"].ToString() == "")
                                    {
                                        if (uploadedResp["message"].ToString() == "")
                                        {
                                            ErrorLog.InfoMessage($"File is not successfully uploaded on Google drive");
                                            Common.Output("File is not successfully uploaded on Google drive");
                                        }
                                        else
                                        {
                                            ErrorLog.InfoMessage($"File is not successfully uploaded on Google drive due to : {uploadedResp["message"].ToString()}");
                                            Common.Output($"File is not successfully uploaded on Google drive due to : {uploadedResp["message"].ToString()}");
                                        }
                                    }
                                    googleUploadedJA.Add(uploadedResp);
                                }
                            }
                            //for create Deal in Ontraport
                            hasCreated = op.CreateEntity(dealProp, dealId, ja, module, googleUploadedJA);

                            if (hasCreated)
                            {
                                successful++;
                            }
                            else
                            {
                                failed++;
                            }
                            counter++;
                        }
                        batchID++;
                        totalProcessed += counter;
                    }
                    else
                    {
                        ErrorLog.InfoMessage($"Total Deals in Hubspot {arr.Count} in Batch {batchID}");
                        Console.WriteLine($"Total Deals in Hubspot {arr.Count} in Batch {batchID}");
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.WriteLogFile(ex.Message, "Catch Exception", entity);
            }

            Console.WriteLine("__________________________________________");
            Console.WriteLine($"Total Deals Processed : {totalProcessed}");
            Console.WriteLine($"Deals Created Successfully Count : {successful}");
            Console.WriteLine($"Deals Creation Failed Count : {failed}");
            Console.WriteLine("__________________________________________");

            ErrorLog.InfoMessage($"Total Deals Processed : {totalProcessed} and Deals Created Successfully Count : {successful} and Deals Creation Failed Count : {failed}");
        }