// Ensures that an AMQP configuration file exists
        static void EnsureConfigurationFile()
        {
            try
            {
                var resourcesDir = ResourcesDirectory;

                // Ensure the resources directory
                if (!Directory.Exists(resourcesDir))
                {
                    Directory.CreateDirectory(resourcesDir);
                }

                // Ensure the configuration file
                var configFilename = ConfigurationFilename;

                if (!File.Exists(configFilename))
                {
                    var config = new AmqpConfiguration();

                    config.Connections = new AmqpConnection[]
                    {
                        new AmqpConnection()
                        {
                            Name               = "localhost",
                            Host               = "localhost",
                            AmqpPort           = 5672,
                            WebPort            = 15672,
                            VirtualHost        = "/",
                            Username           = "******",
                            Password           = "******",
                            ReconnectInterval  = 5,
                            RequestedHeartBeat = 30
                        }
                    };

                    File.WriteAllText(configFilename, JsonUtility.ToJson(config, true));

                    // Update Unity assets (needed to get the editor to see these new assets)
                    AssetDatabase.Refresh();
                }
            }
            catch (Exception ex)
            {
                Debug.LogErrorFormat("{0}", ex);
            }
        }
        // Saves the current connections to disk
        static void SaveConfiguration(bool createConnection = true)
        {
            // Check to see if the current values are for a new connection
            var isNew = true;

            foreach (var c in connections)
            {
                // This is not a new connection...
                if (c.Name == Name)
                {
                    isNew = false;
                    break;
                }
            }

            // If this is a new connection, add it to the list before writing to disk
            if (createConnection && isNew)
            {
                var c = new AmqpConnection();
                c.Name               = Name;
                c.Host               = Host;
                c.AmqpPort           = AmqpPort;
                c.WebPort            = WebPort;
                c.VirtualHost        = VirtualHost;
                c.Username           = Username;
                c.Password           = Password;
                c.ReconnectInterval  = ReconnectInterval;
                c.RequestedHeartBeat = RequestedHeartBeat;
                connections.Add(c);
            }

            // Serialize and save to disk
            try
            {
                var config = new AmqpConfiguration();
                config.Connections = connections.ToArray();
                File.WriteAllText(ConfigurationFilename, JsonUtility.ToJson(config, true));
                LoadConfiguration(true);
            }
            catch (Exception ex)
            {
                Debug.LogErrorFormat("{0}", ex);
            }
        }