public bool Accept(int answerId) { bool result = qService.Accept(answerId); Answer answer = qService.GetAnswer(answerId); if (result && answer.UserId != _currentUserId) { //new Thread(() => //{ Question question = answer.Question; Notification notification = new Notification(); notification.AuthorId = _currentUserId; notification.CreatedDate = DateTime.Now; notification.Content = question.Title; notification.Seen = false; notification.Type = NotificationSettingEnum.AcceptedAnswer; notification.UserId = answer.UserId; notification.Link = Url.Action("Detail", "Question", new { id = question.Id }); cService.AddNotification(notification); using (RealTimeService rService = new RealTimeService(new CPMathHubModelContainer(), notification.UserId)) { IEnumerable <string> connectionIds = RealTimeHub.Connections.GetConnections(notification.UserId); foreach (string conId in connectionIds) { _hub.Clients.Client(conId).notifyNewActivity(rService.CountNewActivityNotification()); } } // } //).Start(); } return(result); }