public WebConnection(string address, string username, string password)
        {
            Address = address;
            _username = username;
            _password = password;

            CsrfTokenContainer = new CsrfTokenContainer();
            CookieContainer = new CookieContainer();
            State = ConnectionState.Closed;
        }
        public void Open()
        {
            const string logonPath = "users/sign_in";
            const string userParamName = "user";
            const string usernameParamName = "username";
            const string passwordParamName = "password";

            if (State != ConnectionState.Open)
            {
                try
                {
                    CsrfTokenContainer = new CsrfTokenContainer();
                    CookieContainer = new CookieContainer();

                    // Only for get CSRF token
                    Get(RequestFactory.CreateGetRequest(this, logonPath,
                                                        new Dictionary<string, object>()));

                    using (HttpWebResponse response = RequestDispatcher.Dispatch(this, RequestFactory.CreatePostRequest(this, logonPath,
                                                         new Dictionary<string, object>
                                                             {
                                                                 {
                                                                     userParamName, new Dictionary<string, object>
                                                                         {
                                                                             {usernameParamName, _username},
                                                                             {passwordParamName, _password}
                                                                         }
                                                                 }
                                                             }))) {
                        RequestDispatcher.ProcessResponse(this, response);
                        if (response.StatusCode != HttpStatusCode.Found)
                            throw new NeedLogonException();
                    }

                    State = ConnectionState.Open;
                }
                catch (Exception exception)
                {
                    Log.Error(exception);
                    State = ConnectionState.Corrupted;
                    throw;
                }
            }
        }