/// <summary>
        ///     Clears the caches.
        /// </summary>
        /// <remarks>Note: the cache is only cleared for the current tenant.</remarks>
        public void Clear()
        {
            InternalClear();

            if (MessageChannel != null)
            {
                var message = new PerTenantEntityTypeCacheMessage
                {
                    Clear = true
                };

                message.TenantIds.Add(RequestContext.TenantId);

                MessageChannel.Publish(message, PublishOptions.None, false, MergeMessages);
            }
        }
 /// <summary>
 /// Merges the messages.
 /// </summary>
 /// <param name="existingMessage">The existing message.</param>
 /// <param name="newMessage">The new message.</param>
 private void MergeMessages(PerTenantEntityTypeCacheMessage existingMessage, PerTenantEntityTypeCacheMessage newMessage)
 {
     existingMessage.Clear |= newMessage.Clear;
     existingMessage.TenantIds.UnionWith(newMessage.TenantIds);
 }