public IViewComponentResult Invoke() { var model = new AccountHeaderViewModel(); model.CurrentUser = _userContext.CurrentUser; if (model.CurrentUser != null) { model.NumberOfUnreadMessages = _messageDao.GetNumberOfUnreadMessagesForUser(model.CurrentUser.Id); } return(View(model)); }