/// <summary>
        /// Gets the Friendly Name to replace a c-code in the URL for the dynamic trial listing page. If there is no exact override for that c-code,
        /// attempt to find a match that contains the given c-code in the EVS mappings.
        /// Sets needsRedirect to true if there is a friendly name override found.
        /// </summary>
        /// <returns>A string with the friendly name for the URL (replaces c-code) if the override exists, otherwise the given c-codes</returns>
        protected string GetFriendlyNameForURL(string param)
        {
            if (FriendlyNameWithOverridesMapping.MappingContainsCode(param, true))
            {
                // If an exact match is found in the Friendly Name With Overrides mapping, return the friendly name and set redirection bool
                needsRedirect = true;
                return(FriendlyNameWithOverridesMapping.GetFriendlyNameFromCode(param, true));
            }
            else if (FriendlyNameMapping.MappingContainsCode(param, true))
            {
                // If an exact match is found in the Friendly Name mapping, return the friendly name and set redirection bool
                needsRedirect = true;
                return(FriendlyNameMapping.GetFriendlyNameFromCode(param, true));
            }
            else
            {
                if (FriendlyNameMapping.MappingContainsCode(param, false))
                {
                    // If an exact match is found in the Friendly Name mapping (without overrides), or if matches are found that contain the given codes and all have the same friendly name,
                    // get the friendly name and set redirection bool.
                    needsRedirect = true;

                    string evsFriendlyName = FriendlyNameMapping.GetFriendlyNameFromCode(param, false);
                    string codesToOverride = FriendlyNameMapping.GetCodeFromFriendlyName(evsFriendlyName);

                    // If the found friendly name has code(s) that there is an entry in the override friendly name mapping for, return the override friendly name.
                    if (FriendlyNameWithOverridesMapping.MappingContainsCode(codesToOverride, true))
                    {
                        return(FriendlyNameWithOverridesMapping.GetFriendlyNameFromCode(codesToOverride, true));
                    }
                    // If the found friendly name do not have code(s) that there is an entry in the override friendly name mapping for, return the original friendly name.
                    else
                    {
                        return(FriendlyNameMapping.GetFriendlyNameFromCode(param, false));
                    }
                }
                else
                {
                    // If a user comes in with a friendly name, get the codes associated with that friendly name.
                    if (FriendlyNameMapping.MappingContainsFriendlyName(param))
                    {
                        string codesToOverride = FriendlyNameMapping.GetCodeFromFriendlyName(param);

                        // If the code(s) have an entry in the override friendly name mapping, and that new friendly name is not the same as the original,
                        // return the override friendly name and set redirection bool.
                        if (FriendlyNameWithOverridesMapping.MappingContainsCode(codesToOverride, true))
                        {
                            if (!string.Equals(param, FriendlyNameWithOverridesMapping.GetFriendlyNameFromCode(codesToOverride, true)))
                            {
                                needsRedirect = true;
                                return(FriendlyNameWithOverridesMapping.GetFriendlyNameFromCode(codesToOverride, true));
                            }
                        }
                    }
                }
            }

            return(param);
        }
        /// <summary>
        /// Sets the Canonical Url of the Disease Page
        /// </summary>
        private void SetUpCanonicalUrl()
        {
            // We set the Canonical Url. We make sure that the Canonical URL has the following format disease/trial type instead of
            // disease/trial type/intervention
            string[] pathTokens = this.CurrAppPath.Split(new char[] { '/' });

            if (pathTokens != null && pathTokens.Length > 0)
            {
                string canonicalUrl = this.CurrentUrl.ToString().ToLower();

                // If there are disease IDs, we check if they have a friendly name for the canonical URL
                if (this.DiseaseIDs != null && this.DiseaseIDs.Length > 0)
                {
                    // Get c-code to friendly name mapping
                    if (FriendlyNameWithOverridesMapping.MappingContainsCode(this.DiseaseIDs.ToLower(), true))
                    {
                        canonicalUrl = canonicalUrl.Replace(this.DiseaseIDs, FriendlyNameWithOverridesMapping.GetFriendlyNameFromCode(this.DiseaseIDs, true));
                    }
                    else
                    {
                        if (FriendlyNameMapping.MappingContainsCode(this.DiseaseIDs.ToLower(), false))
                        {
                            canonicalUrl = canonicalUrl.Replace(this.DiseaseIDs, FriendlyNameMapping.GetFriendlyNameFromCode(this.DiseaseIDs, false));
                        }
                    }
                }

                if (this.TrialType != null)
                {
                    // Get trial type to friendly name mapping
                    if (FriendlyNameWithOverridesMapping.MappingContainsCode(this.TrialType.ToLower(), true))
                    {
                        canonicalUrl = canonicalUrl.Replace(this.TrialType, FriendlyNameWithOverridesMapping.GetFriendlyNameFromCode(this.DiseaseIDs, true));
                    }
                }

                // If there are intervention IDS we strip them from the canonical url
                if (this.InterventionIDs != null && this.InterventionIDs.Length > 0)
                {
                    canonicalUrl = canonicalUrl.Replace("/" + this.InterventionIDs + "/", "").Replace("/" + this.InterventionIDs, "");
                }


                this.PageInstruction.AddUrlFilter(PageAssemblyInstructionUrls.CanonicalUrl, (name, url) =>
                {
                    url.SetUrl(canonicalUrl);
                });
            }
        }