public IHttpActionResult GetById(int id) { try { ItemResponse <ChatMessage> response = new ItemResponse <ChatMessage> { Item = _chatMessageService.ReadById(id) }; return(Ok(response)); } catch (Exception ex) { int currentUser = _userService.GetCurrentUserId(); _appLogService.Insert(new AppLogAddRequest { AppLogTypeId = 1, Message = ex.Message, StackTrace = ex.StackTrace, Title = "Error in " + GetType().Name + " " + System.Reflection.MethodBase.GetCurrentMethod().Name, UserBaseId = currentUser }); return(BadRequest(ex.Message)); } }