title: How do I check to see if a user exists already in the controller?
body: <p>Here is my register method. I changed the register method into a Admin tool. The admin tool works properly without the if statement. However, it does not like the way I am looking for existing users.</p>
  
  <pre><code>    // POST: /Account/Register
  [HttpPost]
  [AllowAnonymous]
  [ValidateAntiForgeryToken]
  public async Task&lt;ActionResult&gt; Register(RegisterViewModel model)
  {    
      if (ModelState.IsValid)
      {
          if(_context.Users.Contains(model.UserName))//Errors out here
          {
              var user = new ApplicationUser { UserName = model.UserName};
              user.UserName = model.UserName;
              var result = await UserManager.CreateAsync(user, model.Password);
              if (result.Succeeded)
              {
                  await this.UserManager.AddToRoleAsync(user.Id, model.Name);
                  return RedirectToAction("Index","User");
              }
          AddErrors(result);
          }
      }
      return View(model);
  }
  </code></pre>