public async Task<IHttpActionResult> CreateUser(CreateUserBindingModel createUserModel)
        {

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var user = new ApplicationUser
            {
                UserName = createUserModel.Username,
                Email = createUserModel.Email,
                FirstName = createUserModel.FirstName,
                LastName = createUserModel.LastName,
                Level = 3,
                JoinDate = DateTime.Now.Date,
                EmailConfirmed = true
            };


            IdentityResult addUserResult = await AppUserManager.CreateAsync(user, createUserModel.Password);

            if (!addUserResult.Succeeded)
            {
                return GetErrorResult(addUserResult);
            }


            Uri locationHeader = new Uri(Url.Link("GetUserById", new { id = user.Id }));

            return Created(locationHeader, TheModelFactory.Create(user));

        }
        public async Task CannotCreateAUserUsernameTaken()
        {
            var model = new CreateUserBindingModel
            {
                Username = "******",
                Email = "*****@*****.**",
                FirstName = "Ismir",
                LastName = "Harambasic",
                Password = "******",
                ConfirmPassword = "******"
            };

            uri = uriBase + "/register";

            var response = await PostAsync(model);
            Assert.AreEqual(HttpStatusCode.BadRequest, response.StatusCode);
        }
        public async Task CanCreateUser()
        {
            var model = new CreateUserBindingModel
            {
                Username = "******" + DateTime.Now.Ticks,
                Email = "ismirharambasic81" + DateTime.Now.Ticks +"@gmail.com",
                FirstName = "Ismir",
                LastName = "Harambasic",
                Password = "******",
                ConfirmPassword = "******"
            };

            uri = uriBase + "/register";

            var response = await PostAsync(model);
            Assert.AreEqual(HttpStatusCode.Created, response.StatusCode);
        }