private async void DrawPackAndSend()
    {
        // Scroll zone if content would be higher than window hight
        _statesScroll = EditorGUILayout.BeginScrollView(_statesScroll, GUILayout.ExpandHeight(false));

        GUILayout.Label("Version on the server:", EditorStyles.boldLabel);
        EditorGUI.indentLevel++;

        // Field of presentation States for this App on Server
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(EditorGUI.indentLevel * 30);
        GUILayout.Label("Already loaded on the server:  " + (serverStatus ? "Yes" : "No"), GUILayout.ExpandWidth(false));
        EditorGUILayout.EndHorizontal();

        // Show States on server if it has them for this app
        if (serverStatus)
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(EditorGUI.indentLevel * 15);
            serverStatesOpend = EditorGUILayout.Foldout(serverStatesOpend, "States:", true);
            EditorGUILayout.EndHorizontal();

            EditorGUI.indentLevel++;
            if (serverStatesOpend)
            {
                int index = 1;
                foreach (string State in serverStates)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(EditorGUI.indentLevel * 30);
                    GUILayout.Label(index.ToString() + ". " + State);
                    EditorGUILayout.EndHorizontal();
                    index++;
                }
            }
        }

        GUILayout.Space(40);

        // Block with current local information fron State object
        GUILayout.Label("Pack and Send to the server:", EditorStyles.boldLabel);
        EditorGUI.indentLevel = 1;

        // App name field
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(EditorGUI.indentLevel * 30);
        GUILayout.Label("Application name:  " + _webConnection.GameName);
        EditorGUILayout.EndHorizontal();

        // Server URL field
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(EditorGUI.indentLevel * 30);
        GUILayout.Label("Send to:  http://" + _webConnection.BaseURL + "/");
        EditorGUILayout.EndHorizontal();

        // Local States field
        EditorGUILayout.BeginHorizontal();
        GUILayout.Space(EditorGUI.indentLevel * 15);
        statesOpend = EditorGUILayout.Foldout(statesOpend, "States:", true);
        EditorGUILayout.EndHorizontal();

        EditorGUI.indentLevel++;
        if (statesOpend)
        {
            int index = 1;
            for (int i = 0; i < _webConnection.GetLenght(); i++)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 30);
                GUILayout.Label(index.ToString() + ". " + _webConnection.GetKey(i));
                EditorGUILayout.EndHorizontal();
                index++;
            }
        }

        EditorGUILayout.EndScrollView();
        GUILayout.Space(20);

        // Check that local and server data are different
        if (!CheckUniq())
        {
            //if yes, draw Pack and send button
            if (Buttons.PackAndSend())
            {
                // Pack States and other info to JSON
                List <string> states = new List <string>();
                for (int i = 0; i < _webConnection.GetLenght(); i++)
                {
                    states.Add(_webConnection.GetKey(i));
                }

                var json = JsonConvert.SerializeObject(new
                {
                    gameName   = _webConnection.GameName,
                    statesList = states
                });

                // And send to server
                HttpClient client = new HttpClient();

                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "http://" + _webConnection.BaseURL + "/api/add_states/add");
                request.Content = new StringContent(json);
                request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

                var response = await client.SendAsync(request);

                reloadServerInfo();
            }
        }
        else
        {
            // if not, draw "All up to date!" phrase
            GUIStyle style = new GUIStyle();
            style.normal.textColor = Color.green;
            style.fontSize         = 17;
            style.alignment        = TextAnchor.MiddleCenter;

            GUILayout.Label("All up to date!", style);
        }
    }
    private void DrawStateEditor()
    {
        if (EditorApplication.isPlaying)
        {
            return;
        }

        // Field for App Name
        GUILayout.Label("Application name:", EditorStyles.boldLabel);
        _webConnection.GameName = EditorGUILayout.TextField(_webConnection.GameName);

        EditorGUILayout.Space();

        // Field for server URL
        GUILayout.Label("Server URL (without protocol):");
        _webConnection.BaseURL = EditorGUILayout.TextField(_webConnection.BaseURL);

        EditorGUILayout.Space();

        // States list
        statesOpend = EditorGUILayout.Foldout(statesOpend, "States:", true);
        EditorGUI.indentLevel++;
        if (statesOpend)
        {
            // Scroll part if it gets higher, than window hight
            _statesScroll = EditorGUILayout.BeginScrollView(_statesScroll);

            for (int i = 0; i < _webConnection.GetLenght(); i++)
            {
                EditorGUILayout.BeginHorizontal();
                GUILayout.Space(EditorGUI.indentLevel * 30);

                // State number
                GUILayout.Label((i + 1).ToString() + ".", GUILayout.Width(15));

                // State name with renaming logic
                string key     = _webConnection.GetKey(i);
                var    _newKey = EditorGUILayout.TextField(key);
                // Check that object doesn't have State with this name
                if (_newKey != _webConnection.GetKey(i))
                {
                    if (!_webConnection.ContainsKey(_newKey))
                    {
                        _webConnection.ChangeKey(key, _newKey);
                        _errorMessage = "";
                    }
                    else
                    {
                        _errorMessage = "State with this name is already exist.";
                    }
                }

                // delete button
                if (Buttons.Delete())
                {
                    _webConnection.Remove(key);
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(EditorGUI.indentLevel * 30);

            // Add button
            if (Buttons.Add())
            {
                // Check that object doesn't have State with empty name
                if (!_webConnection.ContainsKey(""))
                {
                    _webConnection.Add("");
                    _errorMessage = "";
                }
                else
                {
                    _errorMessage = "State with empty name is already exist.";
                }
            }
            EditorGUILayout.EndHorizontal();

            if (!string.IsNullOrEmpty(_errorMessage))
            {
                // throw warning
                EditorGUILayout.HelpBox(_errorMessage, MessageType.Error);
            }

            EditorGUILayout.EndScrollView();
        }
    }