// Adds receiver to sender with specified data label
        // Returns InterModularDataReceiver object, which should be saved and used later
        public static InterModularDataReceiver RegisterDataReceiver(string label, DataArrivedCallback callback, bool sendCache = false)
        {
            InterModularDataReceiver receiver = new InterModularDataReceiver();
            receiver.ReceiveData = callback;
            receiver.DataLabel = label;

            InterModularConnection connection = GetConnection(label);

            connection.AddReceiver(receiver, sendCache);
            return receiver;
        }
 // Adds receiver and if last data is to be sent, it is sent
 public void AddReceiver(InterModularDataReceiver receiver, bool sendCache = false)
 {
     _receivers.Add(receiver);
     if (sendCache && receiver.ReceiveData != null)
         receiver.ReceiveData(_dataCache);
 }
 // Removes receiver from connection
 // If connection is no longer used by any object, remove connection
 public static void UnregisterDataReceiver(InterModularDataReceiver receiver)
 {
     InterModularConnection connection = GetConnection(receiver.DataLabel);
     if (connection.RemoveReceiver(receiver))
         _connections.Remove(connection);
 }
 // Removes receiver from connection and returns true if connection is no longer used by any object
 public bool RemoveReceiver(InterModularDataReceiver receiver)
 {
     _receivers.Remove(receiver);
     if (_receivers.Count == 0 && _senders.Count == 0)
         return true;
     return false;
 }