public async Task<dynamic> CreateUser(RegisterBindingModel createUserModel)
        {

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

            var user = new ApplicationUser()
            {
                UserName = createUserModel.UserName,
                Email = createUserModel.Email,
                FirstName = createUserModel.FirstName,
                LastName = createUserModel.LastName,
                SchoolId = createUserModel.SchoolId,
                XP=0,
                JoinDate = DateTime.Now.Date,
            };

            try
            {
                IdentityResult addUserResult = await this._userManager.CreateAsync(user, createUserModel.Password);

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

                string code = await this._userManager.GenerateEmailConfirmationTokenAsync(user.Id);

                var callbackUrl = new Uri(Url.Link("ConfirmEmailRoute", new { userId = user.Id, code = code }));

                await this._userManager.SendEmailAsync(user.Id,
                                                        "Confirm your account",
                                                        "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                

                return Ok();
            }

            catch (Exception ex)
            {
                if (ex.InnerException != null)
                    return (ex.InnerException.Message);
                else return (ex.Message);
            }
        }
        public async Task<IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var user = new ApplicationUser() { 
                UserName = model.Email, 
                Email = model.Email, 
                FirstName = model.FirstName,
                LastName = model.LastName,
                XP = 0,

            };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

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

            return Ok();
        }