async private System.Threading.Tasks.Task ProcessRemoteCitation(ResultDataGridItem gridItem)
        {
            string apiResultString = await GraphQLQuery(new Dictionary <string, string>
            {
                { "query", "{ caseCitations(condition:{citation: \"" + gridItem.citation + "\"}) { case { id } } }" }
            });

            JObject apiResult = JObject.Parse(apiResultString);

            if (apiResult["data"]["caseCitations"].HasValues)
            {
                string caseID = (string)apiResult["data"]["caseCitations"][0]["case"]["id"];

                string DestinationPath;

                DestinationPath = "https://www.openlaw.nz/case/" + caseID;

                gridItem.ranges.ForEach(range =>
                {
                    range.Hyperlinks.Add(range, DestinationPath, LinkRef);
                });

                gridItem.url = DestinationPath;

                gridItem.status = "Linked";
            }
            else
            {
                gridItem.status = "Not found";
            }
        }
        async private System.Threading.Tasks.Task ProcessLocalCitation(ResultDataGridItem gridItem, bool courtOfAppeal = false, bool appelant = false)
        {
            string apiResultString = await GraphQLQuery(new Dictionary <string, string>
            {
                { "query", "{ caseCitations(condition:{citation: \"" + gridItem.citation + "\"}) { case { pdf { pdfDbKey } } } }" }
            });

            JObject apiResult = JObject.Parse(apiResultString);

            if (apiResult["data"]["caseCitations"].HasValues)
            {
                string fileName = (string)apiResult["data"]["caseCitations"][0]["case"]["pdf"]["pdfDbKey"];
                string FilePath = Directory.GetParent(Globals.ThisAddIn.Application.ActiveDocument.FullName).FullName;
                string RelativePath;
                if (courtOfAppeal)
                {
                    if (appelant)
                    {
                        RelativePath = "Auth\\App Auth";
                    }
                    else
                    {
                        RelativePath = "Auth\\Resp Auth";
                    }
                }
                else
                {
                    RelativePath = "References";
                }

                string absolutePath     = FilePath + "\\" + RelativePath;
                string absoluteFilePath = absolutePath + "\\" + fileName;

                System.IO.Directory.CreateDirectory(absolutePath);

                if (!File.Exists(absoluteFilePath))
                {
                    string URL = $"https://s3-ap-southeast-2.amazonaws.com/openlawnz-pdfs/{fileName}";
                    System.Net.WebClient Client = new WebClient();
                    Client.DownloadFile(URL, absoluteFilePath);
                }

                gridItem.url    = RelativePath + "\\" + fileName;
                gridItem.status = "Linked";

                gridItem.ranges.ForEach(range =>
                {
                    range.Hyperlinks.Add(range, gridItem.url, LinkRef);
                });
            }
            else
            {
                gridItem.status = "Not found";
            }
        }