public void VoteNodeStructureSuggestion(NodeStructureSuggestionVoteViewModel suggestionViewModel)
        {
            var suggestion = _db.NodeStructureSuggestions.Get(suggestionViewModel.SuggestionId);
            var suggestionVote = new NodeStructureSuggestionVote
            {
                Date = DateTime.Now,
                Suggestion = suggestion,
                VoteBy = _db.Users.Get(suggestionViewModel.VoteBy),
                VoteType = suggestionViewModel.VoteType,
                SessionNode = _db.Nodes.Get(suggestion.ParentId ?? 0)
            };

            _db.NodeStructureSuggestionsVotes.Create(suggestionVote);
            _db.Save();

            var isDone = CheckStructureSuggestionVoteDone(suggestionViewModel.SessionId, suggestionViewModel.NodeId, suggestionViewModel.VoteType);

            if (isDone)
            {
                var parentNode = _db.Nodes.Get(suggestionViewModel.NodeId);
                switch (suggestionViewModel.VoteType)
                {
                    case NodeStructureVoteTypes.Initialize:
                        parentNode.State = NodeStates.StructureSuggestionWinner;
                        break;
                    case NodeStructureVoteTypes.DoneLeaf:
                        parentNode.State = NodeStates.WinAndNotLeaf;

                        foreach (var nodeInSuggestion in suggestion.Nodes)
                        {
                            nodeInSuggestion.State = NodeStates.Leaf;
                            nodeInSuggestion.Type = NodeType.Configurator;
                        }

                        break;

                    case NodeStructureVoteTypes.DoneContinue:
                        parentNode.State = NodeStates.WinAndNotLeaf;

                        foreach (var nodeInSuggestion in suggestion.Nodes)
                        {
                            nodeInSuggestion.State = NodeStates.StructureSuggestion;
                            nodeInSuggestion.Type = NodeType.Configurator;
                        }

                        break;
                }
            }

            _db.Save();
        }
 public IEnumerable<SuggestionSessionUserViewModel> VoteNodeStructureSuggestion(NodeStructureSuggestionVoteViewModel suggestion)
 {
     _suggestionService.VoteNodeStructureSuggestion(suggestion);
     return _suggestionService.GetSuggestions(suggestion.SessionId, suggestion.NodeId);
 }