public IActionResult CreatePost([FromBody] Post user) { try { if (user == null) { _serviceLogger.SendHiddenMessageErrorQuery(); return(BadRequest("User is null")); } if (!ModelState.IsValid) { _serviceLogger.SendHiddenMessageErrorQuery(); return(BadRequest("Invalid model")); } user.Id = Guid.NewGuid(); _context.Add(user); _context.SaveChanges(); _serviceLogger.SendHiddenMessageInformation(); return(StatusCode(201)); } catch (Exception ex) { _serviceLogger.SendHiddenMessageError(); return(StatusCode(500, $"Internal server error: {ex}")); } }