public async Task <dynamic> GetCurrentStatus() { var currentQuestion = await _votingRepository.GetCurrentQuestion(); var users = await _votingRepository.GetUsers(); var myVote = currentQuestion == null ? null : currentQuestion.Votes .Where(v => v.User.Name == CurrentUserName) .Select(v => v.Vote) .FirstOrDefault(); var questionVotes = currentQuestion == null? Enumerable.Empty <QuestionVote>() : currentQuestion.Votes; return(new { CurrentQuestion = currentQuestion == null ? null : new { Title = currentQuestion.Title, Active = !currentQuestion.HasFinished, Results = (!currentQuestion.HasFinished) ? Enumerable.Empty <dynamic>() : GetResults(currentQuestion) }, People = users .Select(u => new { Name = u.Name, HasVoted = questionVotes.Any(qv => qv.UserId == u.Id && qv.Vote != null) }), MyCurrentVote = myVote }); }