private ServerContext createServerContext(
      String gitRemoteUrl, AuthenticationInfo authenticationInfo) {
    ServerContext.Type type =
        UrlHelper.isVSO(UrlHelper.getBaseUri(gitRemoteUrl))
            ? ServerContext.Type.VSO_DEPLOYMENT
            : ServerContext.Type.TFS;
    final Client client = ServerContext.getClient(type, authenticationInfo);
    final Validator validator = new Validator(client);
    final UrlHelper.ParseResult uriParseResult = UrlHelper.tryParse(gitRemoteUrl, validator);
    if (uriParseResult.isSuccess()) {
      final ServerContextBuilder builder =
          new ServerContextBuilder()
              .type(type)
              .uri(gitRemoteUrl)
              .authentication(authenticationInfo)
              .teamProject(validator.getRepository().getProjectReference())
              .repository(validator.getRepository())
              .collection(validator.getCollection());

      // Set the uri of the context to the server uri (TODO change context so that it can be any URI
      // in the hierarchy)
      final URI serverUri = URI.create(uriParseResult.getServerUrl());
      builder.uri(serverUri);

      return builder.buildWithClient(client);
    }

    return null;
  }
  /**
   * Use this method to get the appropriate AuthenticationProvider based on an url.
   *
   * @param url
   * @return
   */
  public AuthenticationProvider getAuthenticationProvider(final String url) {
    if (UrlHelper.isVSO(UrlHelper.getBaseUri(url))) {
      return VsoAuthenticationProvider.getInstance();
    }

    return new TfsAuthenticationProvider();
  }