title: How to implement AddToRoleAsync in the user store
body: <p>Using the following user store:</p>
  
  <pre><code>public class UserStore : IUserStore&lt;AspNetUsers&gt;, IUserPasswordStore&lt;AspNetUsers&gt;, IUserSecurityStampStore&lt;AspNetUsers&gt;, ILookupNormalizer, IUserClaimStore&lt;AspNetUsers&gt;, IUserRoleStore&lt;AspNetUsers&gt;
  </code></pre>
  
  <p>How do I implement the implementation for AddToRoleAsync?</p>
  
  <p>I have no idea what I'm doing, this is the mess I have so far:</p>
  
  <pre><code>public async Task AddToRoleAsync(AspNetUsers user, string roleName, CancellationToken cancellationToken)
      {
          var role = await roleStore.FindByNameAsync(Normalize(roleName), cancellationToken);
          if(role != null &amp;&amp; !string.IsNullOrEmpty(role.Name))
          {
              user.AspNetUserRoles.Add(new AspNetUserRoles()
              {
                  RoleId = role.Id,
                  Role = new AspNetRoles()
                  {
                      Id = Guid.NewGuid().ToString(),
                      ConcurrencyStamp = Guid.NewGuid().ToString(),
                      Name = role.Name,
                      NormalizedName = role.NormalizedName
                  },
                  User = user,
                  UserId = user.Id
              });
          }
          else
          {
              Console.WriteLine("Role doesn't exist, please create it");
          }
          await Task.CompletedTask;
      }
  </code></pre>
  
  <h2>Update</h2>
  
  <p>I think this is all I need but a confirmation would be great.</p>
  
  <pre><code>user.AspNetUserRoles.Add(new AspNetUserRoles()
  {
      RoleId = role.Id
  });
  </code></pre>