private async Task<IHttpActionResult> SendLoginInformation(RegisterBindingModel model)
        {

            EmailService emailService = new EmailService();

            IdentityMessage message = new IdentityMessage()
            {
                Subject = "Login Information",
                Body = String.Format("Your username {0} and password: {1}", model.Email, model.Password),
                Destination = model.Email
            };

            try
            {
                await emailService.SendAsync(message);
            }
            catch (Exception e)
            {
                return InternalServerError(); //TODO: display proper error
            }

            return Ok();
        }
        public async Task<IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };

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

            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }
            
            var userInfo = await UserManager.FindAsync(model.Email, model.Password);

            UserDetail userDetail = new UserDetail()
            {
                UserId = userInfo.Id,
                FirstName = model.FirstName,
                LastName = model.LastName
            };

            bool isRegisterUserDetail = _userRepository.RegisterUserDetail(userDetail);

            if (isRegisterUserDetail)
            {
                await SendLoginInformation(model);
                await SendEmailConfirmation(userInfo.Id, model.Email);
            }

            return Ok();
        }