/**
     * Stop broadcasting, used when starting the experiment.
     */
    public void StopBroadcast()
    {
        var networkDiscovery = ICNetworkUtilities.GetNetworkDiscovery();

        if (networkDiscovery.isServer)
        {
            networkDiscovery.StopBroadcast();
        }
    }
    /**
     * Start the lobby in server-mode.
     */
    public void StartServer(ICExperiment experiment)
    {
        var networkDiscovery = ICNetworkUtilities.GetNetworkDiscovery();
        var networkManager   = ICNetworkUtilities.GetNetworkManager();

        // Mark as server
        _isServer = true;

        // Update listeners
        SetupServerEventListeners(networkManager);

        // Start server and initialize broadcast
        networkManager.StartHost();

        networkDiscovery.Initialize();
        networkDiscovery.broadcastData =
            "NetworkManager:" +
            networkManager.networkAddress + ":" +
            networkManager.networkPort + ":" +
            experiment.getDisplayName();

        if (!networkDiscovery.StartAsServer())
        {
            throw new Exception("StartAsServer returned false in ICLobbyController.");
        }

        // Enable start button
        startButton.enabled = true;
        startButton.onClick.RemoveAllListeners();
        startButton.onClick.AddListener(() => { experimentSetup.StartExperiment(experiment); });

        // Remove old synchronization script
        if (syncScript)
        {
            NetworkServer.Destroy(syncScript.gameObject);
            Destroy(syncScript.gameObject);
        }

        // Spawn synchronization script on the network
        syncScript = GameObject.Instantiate(syncScriptPrefab).GetComponent <ICLobbySync>();
        NetworkServer.Spawn(syncScript.gameObject);
        syncScript.transform.SetParent(gameObject.transform);
    }
    /**
     * Stop everything, used when cancelling the lobby.
     */
    public void StopAll()
    {
        var networkDiscovery = ICNetworkUtilities.GetNetworkDiscovery();
        var networkManager   = ICNetworkUtilities.GetNetworkManager();

        if (_isServer)
        {
            networkManager.StopHost();
            if (networkDiscovery.isServer)
            {
                networkDiscovery.StopBroadcast();
            }
            _isServer = false;
        }

        if (isClient)
        {
            networkManager.StopClient();
            _isClient = false;
        }
    }