private bool AddBroadcastMessage(SignedSwimMessage swimMessage)
        {
            lock (_broadcastQueueLock)
            {
                var item = new BroadcastableItem(swimMessage);

                return(ApplyMessageOverrides(item));
            }
        }
        private bool ApplyMessageOverrides(BroadcastableItem item)
        {
            lock (_broadcastQueueLock)
            {
                var items = BroadcastQueue.ToList();

                var toRemove = new List <BroadcastableItem>();

                foreach (var broadcastableItem in items)
                {
                    var m = broadcastableItem.SwimMessage.Message;

                    var w = item.SwimMessage.Message.GetMessageOverrideWeight(m);

                    if (w == 0)
                    {
                        continue;
                    }

                    if (w == 1)
                    {
                        toRemove.Add(broadcastableItem);
                    }

                    if (w == -1)
                    {
                        return(false);
                    }
                }

                foreach (var broadcastableItem in toRemove)
                {
                    items.Remove(broadcastableItem);
                }

                items.Add(item);

                BroadcastQueue = new ConcurrentBag <BroadcastableItem>(items
                                                                       .OrderByDescending(x => x.BroadcastCount));
            }

            return(true);
        }