public async Task <IHttpActionResult> Register(RegisterBindingModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var user = new ApplicationUser() { FirstName = model.FirstName, SecondName = model.SecondName, LastName = model.LastName, UserName = model.Email, Email = model.Email, DateOfBith = model.DateOfBith, Photo = model.Photo, }; IdentityResult result = await UserManager.CreateAsync(user, model.Password); if (!result.Succeeded) { return(GetErrorResult(result)); } UnitOfWork uow = new UnitOfWork(new ApplicationDbContext()); TreeService service = new TreeService(uow); service.CreateTree(user.Id); uow.Commit(); return(Ok()); }