I am using the Microsoft.Graph library [here](https://www.nuget.org/packages/Microsoft.Graph) to update a user in Azure AD. This works for some users, but fails for others. My code looks like this:

```
public async Task<User> UpdateUser(AdUser adUser)
{
    var graphServiceClient = new GraphServiceClient(_azureAuthenticationProvider);

    var user = await GetUser(adUser.UserPrincipalName);

    user.GivenName = adUser.GivenName;
    user.Surname = adUser.LastName;
    user.DisplayName = adUser.DisplayName;
    user.Department = adUser.Department;
    user.AccountEnabled = adUser.AccountEnabled;

    await graphServiceClient.Users[user.UserPrincipalName].Request().UpdateAsync(user);
    await UpdateUserGroups(adUser);

    return await GetUser(adUser.UserPrincipalName);
}

```

The AdUser class is fairly basic and just includes the properties to update:

```
public class AdUser
{
    public string UserPrincipalName { get; set; }
    public string UserName { get; set; }
    public string Password { get; set; }
    public string GivenName { get; set; }
    public string LastName { get; set; }
    public string DisplayName { get; set; }
    public string Department { get; set; }
    public List<string> OldGroups { get; set; }
    public List<string> OldRoles { get; set; }
    public List<string> NewGroups { get; set; }
    public List<string> NewRoles { get; set; }
    public bool AccountEnabled { get; set; }
    public bool ForceChangePasswordNextSignIn { get; set; }
}

```

For the first three users to be updated, this works just fine. On the fourth user, I get a generic AggregateException with the message, "Exception of type 'Microsoft.Graph.ServiceException' was thrown."

Firing up Fiddler shows the failed request:

```
{
  "error": {
    "code": "InternalServerError",
    "message": "Can not add property department to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.",
    "innerError": {
      "request-id": "b82c4098-6031-40c4-ac6a-4f43746e7b48",
      "date": "2016-07-12T05:55:08"
    }
  }
}

```

If I step through the code, I can see the error occurs on this line:

```
await graphServiceClient.Users[user.UserPrincipalName].Request().UpdateAsync(user);

```

This always occurs for the same user. Any ideas?

Thanks!!!

**Update 1:**
For completeness, my GetUser method looks like this:

```
public const string AdUserFields = "UserPrincipalName,DisplayName,GivenName,Surname,Department,MemberOf,AccountEnabled";

public async Task<User> GetUser(string userPrincipalName, string fields = AdUserFields)
{
    var graphServiceClient = new GraphServiceClient(_azureAuthenticationProvider);

    var user = await graphServiceClient.Users[userPrincipalName].Request().Select(fields).GetAsync();

    return user;
}

```

**Update 2:**
The request and response looks like this. Note that I did not construct the JSON, the SDK does that for me. I am aware of the duplicate key in the request:

*REQUEST:*

```
PATCH https://graph.microsoft.com/v1.0/users/jane.doe@contoso.onmicrosoft.com HTTP/1.1
SdkVersion: graph-dotnet-1.0.1
Authorization: Bearer <token>
Cache-Control: no-store, no-cache
Content-Type: application/json
Host: graph.microsoft.com
Content-Length: 478
Expect: 100-continue

{"accountEnabled":true,"businessPhones":[],"department":"department","displayName":"Jane Doe (department)","givenName":"Jane","surname":"Doe","userPrincipalName":"jane.doe@contoso.onmicrosoft.com","id":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users/$entity","givenName":null,"jobTitle":null,"mail":null,"mobilePhone":null,"officeLocation":null,"preferredLanguage":null,"surname":null}

```

*RESPONSE:*

```
HTTP/1.1 500 Internal Server Error
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Server: Microsoft-IIS/8.5
request-id: 2c0437b3-2438-4a34-bf70-937bec2143d1
client-request-id: 2c0437b3-2438-4a34-bf70-937bec2143d1
x-ms-ags-diagnostic: {"ServerInfo":{"DataCenter":"SouthEast Asia","Slice":"SliceB","ScaleUnit":"001","Host":"AGSFE_IN_0","ADSiteName":"SIN"}}
Duration: 30.6384
X-Powered-By: ASP.NET
Date: Wed, 13 Jul 2016 03:08:14 GMT

142
{
  "error": {
    "code": "InternalServerError",
    "message": "Can not add property givenName to Newtonsoft.Json.Linq.JObject. Property with the same name already exists on object.",
    "innerError": {
      "request-id": "2c0437b3-2438-4a34-bf70-937bec2143d1",
      "date": "2016-07-13T03:08:14"
    }
  }
}
0

```