public IActionResult Post([FromBody] PostModel postModel, string category) { if (category != null) { var categoryName = nameof(postModel.Category); postModel.Category = category; ModelState.ClearError(categoryName); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var postToCreate = PostMapper.PostModelToPost(postModel); return(Ok(_postManager.CreatePost(postToCreate).ToString())); }