public async Task <IHttpActionResult> Post([FromBody] Message message) { ServiceLogic serviceLogic = new ServiceLogic(); var userManager = new ApplicationUserManager(new UserStore <ApplicationUserEntity>(SqlDbContext.Create())); var userFromTask = await userManager.FindByNameAsync(User.Identity.Name); var userToTask = await userManager.FindByNameAsync(message.UserNameTo); serviceLogic.SendMessage(userFromTask.Id, userToTask.Id, DateTime.Now, message.MessageText); return(Ok()); }