void OnCollectionRemoved(LocalizedTableCollection collection)
 {
     if (collection is StringTableCollection stringTableCollection)
     {
         if (m_StringTableCollections != null && m_StringTableCollections.Contains(stringTableCollection))
         {
             m_StringTableCollections.Remove(stringTableCollection);
             m_GuidToCollection = null; // Clear cache
         }
     }
     else if (collection is AssetTableCollection assetTableCollection)
     {
         if (m_AssetTableCollections != null && m_AssetTableCollections.Contains(assetTableCollection))
         {
             m_AssetTableCollections.Remove(assetTableCollection);
             m_GuidToCollection = null; // Clear cache
         }
     }
     else
     {
         throw new System.Exception("Unhandled collection type: " + collection.GetType());
     }
 }
        protected virtual void AddToCache(LocalizedTableCollection collection)
        {
            var validState = collection.IsValid;

            if (!validState.valid)
            {
                Debug.LogWarning($"Collection {collection.name} is invalid and will be ignored because {validState.error}.");
                return;
            }

            if (collection is StringTableCollection stringTableCollection)
            {
                if (m_StringTableCollections != null && !m_StringTableCollections.Contains(stringTableCollection))
                {
                    m_StringTableCollections.Add(stringTableCollection);
                    if (m_GuidToCollection != null)
                    {
                        CacheDependencies(stringTableCollection);
                    }
                }
            }
            else if (collection is AssetTableCollection assetTableCollection)
            {
                if (m_AssetTableCollections != null && !m_AssetTableCollections.Contains(assetTableCollection))
                {
                    m_AssetTableCollections.Add(assetTableCollection);
                    if (m_GuidToCollection != null)
                    {
                        CacheDependencies(assetTableCollection);
                    }
                }
            }
            else
            {
                throw new System.Exception("Unhandled collection type: " + collection.GetType());
            }
        }