private void PopulateConfigsDropdown(SpaceInfoModel space)
        {
            ConfigsDropdown.ClearOptions();

            var currConfig = DynamicConfig.Instance.SelectedConfig;

            if (space.Configs != null && space.Configs.Length > 0)
            {
                var opts = space.Configs.Select(c => new Dropdown.OptionData(c.Title)).ToList();

                var optsAndDefault = opts;

                optsAndDefault.Insert(0, new Dropdown.OptionData()
                {
                    text = k_selectAConfigString
                });

                ConfigsDropdown.AddOptions(optsAndDefault);

                var selectedConfigIdx = 1; // set to '1' to co-operate with having a default item in list of dropdown opts

                if (currConfig != null &&
                    m_selectedSpace != null &&
                    m_selectedSpace.Configs != null)
                {
                    for (var cidx = 0; cidx < m_selectedSpace.Configs.Length; cidx++)
                    {
                        var config = m_selectedSpace.Configs[cidx];

                        if (config.Name == currConfig.Name)
                        {
                            selectedConfigIdx = cidx + 1;
                            m_selectedConfig  = config;

                            break;
                        }
                    }
                }

                if (opts.Count > 0)
                {
                    // Listener only fires if we actually change this value
                    if (ConfigsDropdown.value != selectedConfigIdx)
                    {
                        ConfigsDropdown.value = selectedConfigIdx;
                    }
                    else
                    {
                        ConfigChanged(selectedConfigIdx);
                    }
                }
            }
        }
        void SpaceChanged(int idx)
        {
            idx--; // accounts for default in dropdown

            ConfigsDropdown.ClearOptions();

            ConfirmSpaceSelection.interactable = false;
            m_selectedSpace  = null;
            m_selectedConfig = null;

            if (idx >= 0 && idx < DynamicConfig.Instance.UserSpaces.Count)
            {
                m_selectedSpace = DynamicConfig.Instance.UserSpaces[idx];

                PopulateConfigsDropdown(m_selectedSpace);
            }
        }
        void ConfigChanged(int idx)
        {
            idx--; // accounts for default in dropdown

            m_selectedConfig = null;

            if (m_selectedSpace != null &&
                idx >= 0 && idx < m_selectedSpace.Configs.Length)
            {
                m_selectedConfig = m_selectedSpace.Configs[idx];

                ConfirmSpaceSelection.interactable = true;
            }
            else
            {
                ConfirmSpaceSelection.interactable = false;
            }
        }
        /// <summary>
        /// Hits API endpoint to get spaces for logged-in user and populates dropdown
        /// </summary>
        internal void PopulateSpacesDropdown(Action onComplete = null)
        {
            m_selectedSpace  = null;
            m_selectedConfig = null;

            var currSpace = DynamicConfig.Instance.SelectedSpace;

            DynamicConfig.Instance.GetSpaces((success) =>
            {
                ThreadHelper.Instance.CallOnMainThread(() =>
                {
                    if (!success)
                    {
                        // todo What happens if can't hit endpoint for get userspaces? logout?
                        return;
                    }

                    var spaces = DynamicConfig.Instance.UserSpaces;
                    if (spaces == null)
                    {
                        // todo what do if no spaces returned? (but successfully hit endpoint)
                        return;
                    }

                    var spacesOptions = new List <Dropdown.OptionData>();

                    var selectedSpaceIdx = -1;

                    if (spaces.Count > 0)
                    {
                        var sidx = 0;

                        foreach (var s in spaces)
                        {
                            if (currSpace != null && s.Name == currSpace.Name)
                            {
                                m_selectedSpace = s;
                                // Make room for space select
                                selectedSpaceIdx = sidx + 1;
                            }

                            spacesOptions.Add(new Dropdown.OptionData(s.Title));

                            sidx++;
                        }
                    }

                    ConfigsDropdown.ClearOptions();
                    SpacesDropdown.ClearOptions();

                    var spaceOptAndDefault = spacesOptions;

                    spaceOptAndDefault.Insert(0, new Dropdown.OptionData()
                    {
                        text = k_selectASpaceString
                    });
                    SpacesDropdown.AddOptions(spaceOptAndDefault);

                    if (selectedSpaceIdx > 0)
                    {
                        // Listener only fires if we actually change this value
                        if (SpacesDropdown.value != selectedSpaceIdx)
                        {
                            SpacesDropdown.value = selectedSpaceIdx;
                        }
                        else
                        {
                            SpaceChanged(selectedSpaceIdx);
                        }
                    }

                    if (onComplete != null)
                    {
                        onComplete();                     // check login state
                    }
                });
            });
        }