public async Task <IActionResult> Create([FromBody] PostModel postModel) { try { Guid userID = postModel.UserID; // HttpContext.Items["UserID"]; UserModel userModel = await _loginManager.GetByID(userID, true); if (userID != userModel.ID) { throw new ArgumentException("Poster user ID is not equals to body user ID."); } postModel.User = userModel; await _postsManager.CreateAsync(postModel); return(Ok()); } catch (Exception ex) { return(BadRequest($"Bad Request Here {ex.Message}")); } }