public async Task <int> GenerateDraw(DrawConfiguration drawConfiguration) { IEnumerable <Ballot> ballots = await _lottery.GenerateBallotsAsync(drawConfiguration.NumberOfBallots); var draw = new Draw { SellUntilDate = drawConfiguration.SellUntilDate, Ballots = ballots }; draw.AddPrice(PriceType.Main, drawConfiguration.MainPriceAmount); draw.AddPrice(PriceType.FinalDigit, drawConfiguration.FinalNumberPriceAmount); int drawNumber = _drawRepository.Insert(draw); return(drawNumber); }