/// <summary>
        /// constructor. creates vision service reference. The web.config or app.config must have corresponding
        /// configuration sections for both "DeltekVisionOpenAPIWebServiceSoap" and "DeltekVisionOpenAPIWebServiceSoapSSL"
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="database"></param>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="useHTTPS"></param>
        /// <param name="httpsUser"></param>
        /// <param name="httpsPassword"></param>
        /// <param name="httpsDomain"></param>
        /// <param name="useSession"></param>
        public VisionAPIRepository(string uri, string database, string username, string password,
                                   bool useHTTPS   = false, string httpsUser = "", string httpsPassword = "", string httpsDomain = "",
                                   bool useSession = true)
        {
            try
            {
                service = GetService(uri, useHTTPS, httpsUser, httpsPassword, httpsDomain);

                this.database   = database;
                this.username   = username;
                this.password   = password;
                this.useSession = useSession;
            }
            catch (Exception ex)
            {
                logger.Error(ex, $"Connection to service failed with URI {uri}");
                throw new ApplicationException($"Connection to service failed with URI {uri}", ex);
            }
        }
        /// <summary>
        /// checks service info
        /// </summary>
        /// <param name="uri"></param>
        /// <param name="useHTTPS"></param>
        /// <param name="httpsUser"></param>
        /// <param name="httpsPassword"></param>
        /// <param name="httpsDomain"></param>
        /// <returns></returns>
        public static VisionAPI.DeltekVisionOpenAPIWebServiceSoapClient GetService(string uri, bool useHTTPS = false, string httpsUser = "", string httpsPassword = "", string httpsDomain = "")
        {
            VisionAPI.DeltekVisionOpenAPIWebServiceSoapClient _service;

            if (useHTTPS)
            {
                _service = new VisionAPI.DeltekVisionOpenAPIWebServiceSoapClient("DeltekVisionOpenAPIWebServiceSoapSSL");
            }
            else
            {
                _service = new VisionAPI.DeltekVisionOpenAPIWebServiceSoapClient("DeltekVisionOpenAPIWebServiceSoap");
            }

            _service.Endpoint.Address = new System.ServiceModel.EndpointAddress(uri);

            if (useHTTPS && string.IsNullOrEmpty(httpsUser) == false)
            {
                _service.ClientCredentials.Windows.ClientCredential          = new System.Net.NetworkCredential(httpsUser, httpsPassword, httpsDomain);
                _service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Identification;
            }

            return(_service);
        }