public IHttpActionResult LogIn([FromBody] LogInUser user) { try { if (logInService.ValidateLogIn(LogInUser.ToEntity(user))) { Guid token = sessionHandler.GetToken(LogInUser.ToEntity(user)); GetSession session = GetSession.ToModel(sessionHandler.GetSessionByUser(LogInUser.ToEntity(user))); User registeredUser = userService.GetByEmail(LogInUser.ToEntity(user).Email); loggingService.AddLogForLogin(registeredUser.UserName); return(Ok(session)); } } catch (MissingUserException e) { return(BadRequest(e.Message)); } return(BadRequest()); }