public async Task <AddOpinionResponse> Handle(AddOpinionRequest request, CancellationToken cancellationToken) { var opinionAdded = await opinionService.AddOpinion(request.Text, request.Rating, request.UserId); if (opinionAdded != null) { var notification = await notifier.Push(NotificationMessages.NewOpinionAdded(opinionAdded.Creator.UserName), opinionAdded.UserId); await hubManager.Invoke(SignalrActions.NOTIFICATION_RECEIVED, opinionAdded.UserId, mapper.Map <NotificationDto>(notification)); return(new AddOpinionResponse { Opinion = mapper.Map <OpinionDto>(opinionAdded), NewRating = RatingUtils.CalculateRating(opinionAdded.User) }); } throw new CrudException("Adding opinion failed"); }