/// <summary>
        /// Adds hyperlink to OneDrive in email's body if attachments present.
        /// </summary>
        /// <returns> Email's new body with hyperlink </returns>
        public async Task <string> addAttachmentsToBody(string attachmentsLocation, string emailId, string accessToken)
        {
            // Get access token
            // Was commented out
            var token = Data.GetUserSessionToken(Settings.GetUserAuthStateId(ControllerContext.HttpContext), Settings.AzureADAuthority);

            string body = await GraphApiHelper.getMessageBody(token.AccessToken, emailId);

            // For embedded images, remove <img > before adding links
            string img;
            string hyperlink;
            bool   oneLinkAvailable = true;

            do
            {
                img = Format.getBetween(body, "<img ", ">");

                // Replace with hyperlink to attachment
                string delete = "<img " + img + ">";
                hyperlink = "<a href=\"" + attachmentsLocation + "\"> View Attachments </a>";

                // Replace first <img > with hyperlink
                if (oneLinkAvailable && img != "")
                {
                    body             = body.Replace(delete, hyperlink);
                    oneLinkAvailable = false;
                }
                else
                {
                    body = body.Replace(delete, "");
                }
            } while (img != "");


            string pageBreak = "<div style=\"font - family:Calibri,Arial,Helvetica,sans - serif; font - size:12pt; color: rgb(0, 0, 0)\"><br></div>";

            // If no embedded attachments, add a link at the beginning of the email
            if (oneLinkAvailable)
            {
                string oldBody = Format.getBetween(body, "<body dir=\"ltr\">", "</body>");
                string newBody = hyperlink + pageBreak + oldBody;

                oldBody = "<body dir=\"ltr\">" + oldBody + "</body>";
                newBody = "<body dir=\"ltr\">" + newBody + "</body>";

                body = body.Replace(oldBody, newBody);
            }
            return(body);
        }