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

            // create user
            User _user = new User {
                FirstName    = model.FirstName,
                LastName     = model.LastName,
                Email        = model.Email,
                PhoneNumber  = model.PhoneNumber,
                UserType     = model.UserType,
                CreationDate = DateTime.Now
            };

            // attach user
            using (IWriteUnitOfWork writeUnitOfWork = new WriteUnitOfWork()) {
                var repository = new WriteRepository <User, int>(writeUnitOfWork);
                repository.Attach(_user);
                repository.UnitOfWork.SaveChanges();
            }

            var user = new ApplicationUser()
            {
                UserName = model.Email, Email = model.Email, UserId = _user.Id
            };
            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

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

            return(Ok());
        }