private BootstrappedProject GenerateConsoleProject(SolutionConfiguration solutionConfig, List <ProjectReferenceData> projectDependencies)
        {
            var consoleProject = new BootstrappedProject()
            {
                ProjectName = TextPlaceholder.ConsoleProjectName,
                ProjectGuid = Guid.NewGuid()
            };

            var busConfigurations = new List <string>
            {
                GetMethodBody(TransportMethods.MethodsDictionary[solutionConfig.Transport]),
                GetMethodBody(SerializerMethods.MethodsDictionary[solutionConfig.Serializer]),
                GetMethodBody(PersistenceMethods.MethodsDictionary[solutionConfig.Persistence]),
            };

            var uniqueMessages = GetUniqueMessages(solutionConfig);

            var commandExamples =
                uniqueMessages
                .Where(i => !i.IsEvent)
                .Select(m =>
                        GetMethodBody(BusMethods.MethodsDictionary[BusMethod.Send]).Replace(TextPlaceholder.MessagePlaceholder, m.MessageTypeName));

            var eventExamples =
                uniqueMessages
                .Where(i => i.IsEvent)
                .Select(m =>
                        GetMethodBody(BusMethods.MethodsDictionary[BusMethod.Publish]).Replace(TextPlaceholder.EventPlaceholder, m.MessageTypeName));

            var messageExamples = new List <string>();

            messageExamples.AddRange(commandExamples);
            messageExamples.AddRange(eventExamples);

            var programContent = GetClassTemplate <Program>();

            programContent = PlaceIndentedMultiLineText(programContent, TextPlaceholder.BusConfigurationCallsPlaceholder, busConfigurations);
            programContent = PlaceIndentedMultiLineText(programContent, TextPlaceholder.BusExampleCalls, messageExamples);

            consoleProject.ProjectRoot.Files.Add(new FileAbstraction()
            {
                Name    = "Program.cs",
                Content = programContent
            });

            var nugetDependencies =
                dependencyMapper.GetDependencies(solutionConfig.NServiceBusVersion, solutionConfig.Transport);

            consoleProject.ProjectRoot.Files.Add(NuGetPackagesTemplator.CreatePackagesFile(nugetDependencies));
            consoleProject.ProjectRoot.Files.Add(AppConfigTemplator.CreateAppConfig(solutionConfig));
            consoleProject.ProjectRoot.Files.Add(new FileAbstraction()
            {
                Name = "ProvideErrorConfiguration.cs", Content = GetClassTemplate <ProvideErrorConfiguration>()
            });

            consoleProject.ProjectRoot.Files.Add(new FileAbstraction()
            {
                Name    = consoleProject.ProjectName + ".csproj",
                Content = ProjectFileTemplator.CreateProjectFile(consoleProject, ProjectType.Exe, projectDependencies)
            });

            return(consoleProject);
        }
        BootstrappedProject GenerateEndpoint(EndpointConfiguration endpointConfig, List <ProjectReferenceData> dependencies)
        {
            var endpointConfigTemplate = GetClassTemplate <ProgramService>();

            var project = new BootstrappedProject()
            {
                ProjectName = endpointConfig.EndpointName,
                ProjectGuid = endpointConfig.ProjectGuid
            };

            var endpointClassText =
                endpointConfigTemplate
                .Replace(TextPlaceholder.EndpointNamePlaceholder, endpointConfig.EndpointName);

            var busConfigurations = new List <string>
            {
                GetMethodBody(TransportMethods.MethodsDictionary[endpointConfig.Transport]),
                GetMethodBody(SerializerMethods.MethodsDictionary[endpointConfig.Serializer]),
                GetMethodBody(PersistenceMethods.MethodsDictionary[endpointConfig.Persistence])
            };

            var subscriptions = new List <string>();

            if (endpointConfig.InCodeSubscriptions)
            {
                var subscribeTemplate = GetMethodBody(BusMethods.MethodsDictionary[BusMethod.Subscribe]);
                foreach (var messageHandler in endpointConfig.MessageHandlers)
                {
                    subscriptions.Add(subscribeTemplate.Replace(typeof(MessagePlaceholder).Name, messageHandler.MessageTypeName));
                }
            }

            endpointClassText = PlaceIndentedMultiLineText(endpointClassText, TextPlaceholder.BusConfigurationCallsPlaceholder, busConfigurations);
            endpointClassText = PlaceIndentedMultiLineText(endpointClassText, TextPlaceholder.InCodeSubscriptionPlaceholder, subscriptions);

            project.ProjectRoot.Files.Add(new FileAbstraction()
            {
                Name = "ProgramService.cs", Content = endpointClassText
            });
            project.ProjectRoot.Files.Add(new FileAbstraction()
            {
                Name = "ProvideErrorConfiguration.cs", Content = GetClassTemplate <ProvideErrorConfiguration>()
            });

            var messageHandlers = endpointConfig.MessageHandlers.Select(m => new FileAbstraction()
            {
                Name    = m.MessageTypeName + "Handler.cs",
                Content =
                    GetClassTemplate <MessageHandler>()
                    .Replace("MessageHandler", m.MessageTypeName + "Handler")
                    .Replace(TextPlaceholder.EndpointNamePlaceholder, endpointConfig.EndpointName)
                    .Replace(TextPlaceholder.MessagePlaceholder, m.MessageTypeName)
            });

            project.ProjectRoot.Files.Add(NuGetPackagesTemplator.CreatePackagesFile(endpointConfig, dependencyMapper));
            project.ProjectRoot.Files.Add(AppConfigTemplator.CreateAppConfig(endpointConfig));

            project.ProjectRoot.Folders.Add(new FolderAbstraction()
            {
                Files = messageHandlers.ToList()
            });

            //var endpointConfigTree = CSharpSyntaxTree.ParseText(endpointClassText);

            project.ProjectRoot.Files.Add(new FileAbstraction()
            {
                Name    = project.ProjectName + ".csproj",
                Content = ProjectFileTemplator.CreateProjectFile(project, ProjectType.Exe, dependencies, isSelfHost: true)
            });

            return(project);
        }