public IEnumerable Handle(Func <Guid, StepladderMatchAggregate> al, CreateStepladderMatch command)
        {
            var agg = al(command.Id);

            if (agg.EventsLoaded > 0)
            {
                throw new MatchAlreadyCreated();
            }

            var tournament = CommandQueries.GetTournaments().FirstOrDefault(x => x.Year == command.Year);
            var awayBowler = CommandQueries.GetParticipant(command.AwayBowlerId);
            var homeBowler = CommandQueries.GetParticipant(command.HomeBowlerId);

            yield return(new StepladderMatchCreated
            {
                Id = command.Id,
                TournamentId = tournament.Id,
                Year = command.Year,
                Away = awayBowler.Id,
                AwayBowler = awayBowler.Name,
                Home = homeBowler.Id,
                HomeBowler = homeBowler.Name,
                Gender = homeBowler.Gender,
                Created = DateTime.Now,
            });
        }
        public JsonResult CreateStepladderMatch(CreateStepladderMatch command)
        {
            command.Id = Guid.NewGuid();
            Domain.Dispatcher.SendCommand(command);
            var match = Domain.StepladderQueries.GetMatches(command.Year)
                        .FirstOrDefault(x => x.Id == command.Id);

            return(Json(match));
        }