//public IEnumerable<ArkTamedCreature> NoRafts => TamedCreatures?.Where(x => !x.ClassName.Equals("Raft_BP_C"));

        //public IEnumerable<ArkTamedCreature> CloudCreatures
        //{
        //    get
        //    {
        //        var cluster = _contextManager.GetCluster(Config.Cluster);
        //        var cloudCreatures = cluster?.CloudInventories?.SelectMany(x => x.Dinos);

        //        return cloudCreatures;
        //    }
        //}

        //public IEnumerable<ArkTamedCreature> InclCloud
        //{
        //    get
        //    {
        //        var cluster = _contextManager.GetCluster(Config.Cluster);
        //        var cloudCreatures = cluster?.CloudInventories?.SelectMany(x => x.Dinos);

        //        if (cloudCreatures == null) return TamedCreatures;
        //        if (TamedCreatures == null) return cloudCreatures;
        //        return cloudCreatures.Concat(TamedCreatures);
        //    }
        //}

        //public IEnumerable<ArkTamedCreature> InclCloudNoRafts
        //{
        //    get
        //    {
        //        var cluster = _contextManager.GetCluster(Config.Cluster);
        //        var cloudCreatures = cluster?.CloudInventories?.SelectMany(x => x.Dinos)?.Where(x => !x.ClassName.Equals("Raft_BP_C"));

        //        if (cloudCreatures == null) return NoRafts;
        //        if (NoRafts == null) return cloudCreatures;
        //        return cloudCreatures.Concat(NoRafts);
        //    }
        //}

        internal void CopyTo(ArkGameDataBase other)
        {
            other.SaveState             = SaveState;
            other._tamedCreatures       = _tamedCreatures;
            other._wildCreatures        = _wildCreatures;
            other._players              = _players;
            other._tribes               = _tribes;
            other._items                = _items;
            other._droppedItems         = _droppedItems;
            other._structures           = _structures;
            other._playerTamedCreatures = _playerTamedCreatures;
            other._tribeTamedCreatures  = _tribeTamedCreatures;
            other._playerStructures     = _playerStructures;
            other._tribeStructures      = _tribeStructures;
            other._playerTribes         = _playerTribes;
            other._tribePlayers         = _tribePlayers;
            other._inventoryItems       = _inventoryItems;
            other._deathCache           = _deathCache;

            other.Rafts            = Rafts;
            other.NoRafts          = NoRafts;
            other.CloudCreatures   = CloudCreatures;
            other.InclCloud        = InclCloud;
            other.InclCloudNoRafts = InclCloudNoRafts;
        }
        private void ApplyNewData(ArkSavegame save, ArkTamedCreature[] tamed, ArkWildCreature[] wild, ArkPlayer[] players, ArkTribe[] tribes, ArkItem[] items, ArkDroppedItem[] droppedItems, ArkStructure[] structures, bool decouple = true, ArkDeathCache[] deathCache = null, ArkAnonymizeData anonymize = null)
        {
            // Anonymize data if requested
            if (anonymize != null)
            {
                foreach (var i in players)
                {
                    anonymize.Do(i);
                }
                foreach (var i in tribes)
                {
                    anonymize.Do(i);
                }
                foreach (var i in tamed)
                {
                    anonymize.Do(i);
                }
                foreach (var i in structures)
                {
                    anonymize.Do(i);
                }
            }

            // Setup relations in the domain model between entities
            var newGameData = new ArkGameDataBase(save.SaveState, tamed, wild, players, tribes, items, droppedItems, structures, deathCache);

            newGameData.Initialize(_clusterData);
            foreach (var i in tamed)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in wild)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in players)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in tribes)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in items)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in droppedItems)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in structures)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in deathCache)
            {
                i.Initialize(newGameData, _clusterData);
            }

            if (decouple) //should always be true except for debugging
            {
                // Unset all references to raw extracted game objects and properties to free memory
                foreach (var i in tamed)
                {
                    i.Decouple();
                }
                foreach (var i in wild)
                {
                    i.Decouple();
                }
                foreach (var i in players)
                {
                    i.Decouple();
                }
                foreach (var i in tribes)
                {
                    i.Decouple();
                }
                foreach (var i in items)
                {
                    i.Decouple();
                }
                foreach (var i in droppedItems)
                {
                    i.Decouple();
                }
                foreach (var i in structures)
                {
                    i.Decouple();
                }
                foreach (var i in deathCache)
                {
                    i.Decouple();
                }
            }

            // Assign updated data to public properties
            newGameData.CopyTo(this);

            // Force an immediate garbage collection because it seems more effective (extraction process requires a great deal of memory)
            //GC.Collect();
        }
        private void ApplyNewData(ArkSavegame save, ArkTamedCreature[] tamed, ArkWildCreature[] wild, ArkPlayer[] players, ArkTribe[] tribes, ArkItem[] items, ArkStructure[] structures, bool decouple = true)
        {
            // Setup relations in the domain model between entities
            var newGameData = new ArkGameDataBase(save.SaveState, tamed, wild, players, tribes, items, structures);

            newGameData.Initialize(_clusterData);
            foreach (var i in tamed)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in wild)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in players)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in tribes)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in items)
            {
                i.Initialize(newGameData, _clusterData);
            }
            foreach (var i in structures)
            {
                i.Initialize(newGameData, _clusterData);
            }

            if (decouple) //should always be true except for debugging
            {
                // Unset all references to raw extracted game objects and properties to free memory
                foreach (var i in tamed)
                {
                    i.Decouple();
                }
                foreach (var i in wild)
                {
                    i.Decouple();
                }
                foreach (var i in players)
                {
                    i.Decouple();
                }
                foreach (var i in tribes)
                {
                    i.Decouple();
                }
                foreach (var i in items)
                {
                    i.Decouple();
                }
                foreach (var i in structures)
                {
                    i.Decouple();
                }
            }

            // Assign updated data to public properties
            newGameData.CopyTo(this);
        }
 internal void Initialize(ArkGameDataBase gameData, ArkClusterDataBase clusterData)
 {
     _gameData    = gameData;
     _clusterData = clusterData;
 }