public IActionResult Get(string id) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (!ObjectId.TryParse(id, out var objectId)) { return(BadRequest("'Id' parameter is ivalid ObjectId")); } var postToReturn = _postManager.GetPostById(objectId); if (postToReturn == null) { return(NotFound()); } return(Ok(PostMapper.PostToPostModel(postToReturn))); }