public async Task <IActionResult> AddFlagToMessage(int id) { if (id < 1) { return(BadRequest(new ErrorResponse("The provided message ID cannot be less than 1."))); } try { await _timelineService.AddFlagToMessage(id); } catch (UnknownMessageException exception) { // TODO: Add logging of the exception, when the 'feature/audit-logging' branch has been merged into master return(BadRequest(new ErrorResponse(exception))); } ViewData["messages"] = new List <string> { "The message was successfully flagged and hidden from non-administrator users." }; return(RedirectToAction(nameof(Timeline))); }