I want to programmatically retrieve information of all pull requests associated to a work item in Azure DevOps using Azure DevOps WebAPI.
I have figured out how to retrieve an instance of 

```
Microsoft.TeamFoundation.WorkItemTracking.WebApi.Model.WorkItem

```

For my work item.

To find the pull requests related to it, I can iterate through the Relations field and find a relation where Url contains `PullRequestId`. At the end of that string, I can locate the Pull Request id to be used with the `GetPullRequestAsync`. 

The URL might look like this:

```
vstfs:///Git/PullRequestId/2139bb34-57e3-4d7d-a6e1-1c0542a45e29%2F8a2b707f-ca7a-418d-8462-2bf076a54aad%2F39723

```

So my code would look like this:

```
foreach ( WorkItemRelation wir in wi.Relations)
{
     if ( wir.Url.Contains("PullRequestId"))
     {
          var pr = build.GetPullRequestAsync("<MyProject>", "Providername", "39723", "repository id").Result;
          // Do somethin with pr object
     }
}

```

My issues with this are the following

1. Parsing the URL to retrieve the Pull Request id does not seem a good way to do this. Can I not get the id from some field or so?
2. `GetPullRequestAsync` requires a provider name and repository id. 
But should that information not be retrievable from the instance of 
 `Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItemRelation`.
3. Is there another easier way of doing what I am trying to do?