private static IGitProvider GetProvider(ProviderType providerType)
        {
            var loaderConfigurationSection = (ConfigurationManager.GetSection("LoaderConfiguration") as LoaderConfigurationSection);

            if (loaderConfigurationSection == null)
            {
                throw new ApplicationException("LoaderConfiguration section is missing");
            }
            var providerConfig = loaderConfigurationSection.Providers.Where(w => w.Type == providerType).FirstOrDefault();

            if (providerConfig == null)
            {
                throw new ApplicationException(string.Format("{0} provider configuration is missing", providerType));
            }
            IGitProvider provider;

            if (providerType == ProviderType.Github)
            {
                var githubService = new GithubService(providerConfig);
                provider = new GithubProvider(githubService);
            }
            else
            {
                var bitbucketService = new BitbucketService(providerConfig);
                provider = new BitbucketProvider(bitbucketService);
            }

            return(provider);
        }
 public BitbucketProxy(string clientId, string clientSecret, Func <HttpClientHandler, HttpClient> httpClientFactory = null)
 {
     _provider = new BitbucketProvider(clientId, clientSecret, httpClientFactory);
 }