/// <summary>
 /// Handles links embedded in HTTP response headers.
 /// </summary>
 /// <param name="headers">The headers to check for links.</param>
 /// <param name="links">A dictionary to add found links to.</param>
 /// <param name="linkTemplates">A dictionary to add found link templates to.</param>
 protected virtual void HandleHeaderLinks(HttpResponseHeaders headers, IDictionary<string, Dictionary<Uri, string>> links, IDictionary<string, UriTemplate> linkTemplates)
 {
     foreach (var header in headers.GetLinkHeaders().Where(x => x.Rel != null))
     {
         if (header.Templated)
             linkTemplates[header.Rel] = new UriTemplate(header.Href);
         else
             links.GetOrAdd(header.Rel)[new Uri(Uri, header.Href)] = header.Title;
     }
 }