public Task <int> Execute(GenerateOptions options)
            {
                _kernel.Bind <ScgOptionsRepository>().ToSelf().InSingletonScope();
                _kernel.Bind <ScgOptions>().ToMethod(p => _kernel.Get <ScgOptionsRepository>().Options);

                _kernel.Bind <FileRepository>().ToSelf().InSingletonScope().WithConstructorArgument("game", options.Game);
                _kernel.Bind <GameMetadataReader>().ToSelf().InSingletonScope();
                _kernel.Bind <GameMetadata>().ToConstant(_kernel.Get <GameMetadataReader>().Read());
                _kernel.Bind <GenerationResult>().ToConstant(new GenerationResult());
                _kernel.Bind <BggApiService>().ToSelf();

                _kernel.Bind <IDateTime>().To <DateTimeWrapper>();

                _kernel.Bind <GlobalRepository>().ToSelf().InSingletonScope();
                _kernel.Bind <FlagsDictionary>().ToSelf().InSingletonScope();
                _kernel.Bind <ChallengeGenerationWorkflow>().ToSelf().InSingletonScope();
                _kernel.Bind <ChallengeGenerator>().ToSelf().InSingletonScope();
                _kernel.Bind <BuildingData>().ToSelf().InSingletonScope();
                _kernel.Bind <ChallengeData>().ToSelf().InSingletonScope();
                _kernel.Bind <GameOptions>().ToSelf().InSingletonScope();

                _kernel.Bind(s => s.FromAssembliesMatching("scg.dll").IncludingNonPublicTypes()
                             .Select(type => type.GetInterfaces().Contains(typeof(ITemplateGenerator)))
                             .BindAllInterfaces()
                             .Configure(x => x.InSingletonScope()));

                return(_kernel.Get <ChallengeGenerationWorkflow>().Run(options));
            }
        private async Task PublishToBGG(GenerateOptions options, GenerationResult generationResult)
        {
            var user     = _options.Username ?? ConsoleUtils.ReadValidString(options.User, "Username: "******"Password: "******".\", image.Filename);

                generationResult.UpdateImageId(image.Identifier, imageId);
            }

            var forumId = _metadata.PostFormData.ForumId;

            var threadUri = await _bggApiService.PostThread(generationResult.ChallengePost.Subject, generationResult.ChallengePost.Body,
                                                            forumId, _metadata.PostFormData.ObjectId, _metadata.PostFormData.ObjectType);

            Console.WriteLine($"Challenge posted at '{threadUri.OriginalString}'.");
            threadUri.OpenInBrowser();

            generationResult.GeeklistPost.IncludeThread(BggUtils.GetThreadFromLocation(threadUri.ToString()));
            await _bggApiService.PostGeeklistItem(generationResult.GeeklistPost.Comments,
                                                  GlobalIdentifiers.GeekListId, _metadata.GeeklistFormData.ObjectId,
                                                  _metadata.GeeklistFormData.ObjectType, _metadata.GeeklistFormData.GeekItemName,
                                                  _metadata.GeeklistFormData.ImageId);

            Console.WriteLine("Challenge added to solo challenges geeklist.");
            new Uri($"https://boardgamegeek.com/geeklist/{GlobalIdentifiers.GeekListId}").OpenInBrowser();
        }
        public async Task <int> Run(GenerateOptions options)
        {
            var generationResult = _challengeGenerator.Generate();

            if (options.Publish)
            {
                await PublishToBGG(options, generationResult);
            }
            else
            {
                await SaveToFile(generationResult);
            }
            return(0);
        }
        public static Task <int> Generate(GenerateOptions options)
        {
            var bootstrapper = new Bootstrapper();

            return(bootstrapper.Execute(options));
        }