/// <summary>
 /// Register ILanguageGenerator as default langugage generator.
 /// </summary>
 /// <param name="botAdapter">botAdapter to add services to.</param>
 /// <param name="resourceExplorer">resourceExporer to provide to LanguageGenerator.</param>
 /// <param name="languageGenerator">LanguageGenerator to use.</param>
 /// <param name="messageGenerator">(OPTIONAL) Default is TextMessageActivityGenerator(). </param>
 /// <returns>botAdapter.</returns>
 public static BotAdapter UseLanguageGeneration(this BotAdapter botAdapter, ResourceExplorer resourceExplorer, ILanguageGenerator languageGenerator, IActivityGenerator messageGenerator = null)
 {
     DeclarativeTypeLoader.AddComponent(new LanguageGenerationComponentRegistration());
     botAdapter.Use(new RegisterClassMiddleware <LanguageGeneratorManager>(new LanguageGeneratorManager(resourceExplorer ?? throw new ArgumentNullException(nameof(resourceExplorer)))));
     botAdapter.Use(new RegisterClassMiddleware <ILanguageGenerator>(languageGenerator ?? throw new ArgumentNullException(nameof(languageGenerator))));
     botAdapter.UseMessageActivityGeneration(messageGenerator);
     return(botAdapter);
 }