public async Task<IHttpActionResult> Login(UserModel userModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            ApplicationUser result;
            try
            {
                using (AuctionDbRepository repository = new AuctionDbRepository())
                {
                    result = await repository.FindUser(userModel.Name, userModel.Password);
                }

	            if (result == null)
	            {
		            return NotFound();
	            }
            }
			catch (Exception exception)
            {
				return NotFound();
            }

            return Ok(result.Id);
        }
        public async Task<IHttpActionResult> Register(UserModel userModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            IdentityResult result;
            try
            {
                result = await repo.RegisterUser(userModel);
            }
            catch (Exception exception)
            {
				return BadRequest(exception.Message);
            }
           

            IHttpActionResult errorResult = GetErrorResult(result);

            if (errorResult != null)
            {
                return errorResult;
            }

            return Ok();
        }
        public async Task<IdentityResult> RegisterUser(UserModel userModel)
        {
            ApplicationUser user = new ApplicationUser()
            {
                UserName = userModel.Name
            };

            return await applicationUserManager.CreateAsync(user, userModel.Password);
        }