public T[] ToArray(int instanceID, int category, CraftingProgressShareSetting shareSetting)
        {
            if (IsShared(shareSetting))
            {
                return(_sharedDict[category].ToArray());
            }

            return(new [] { _singleInstance });
//            return _list.ToArray();
        }
        public void Remove(int instanceID, int category, CraftingProgressShareSetting shareSetting)
        {
            if (IsShared(shareSetting))
            {
                if (_sharedDict.ContainsKey(category))
                {
                    _sharedDict[category].RemoveAll(o => o.instanceID == instanceID);
                }
            }
            else
            {
//                _list.RemoveAll(o => o.instanceID == instanceID);
            }
        }
        public T Add(T item, int category, CraftingProgressShareSetting shareSetting)
        {
            if (IsShared(shareSetting))
            {
                if (_sharedDict.ContainsKey(category) == false)
                {
                    _sharedDict.Add(category, new List <T>());
                }

                _sharedDict[category].Add(item);
            }
            else
            {
//                _list.Add(item);
            }

            return(item);
        }
        public CraftingProgressContainer Get(ICraftingActionValidator validator, int instanceID, int category, CraftingProgressShareSetting shareSetting)
        {
            if (IsShared(shareSetting))
            {
                if (_sharedDict.ContainsKey(category))
                {
                    if (shareSetting == CraftingProgressShareSetting.ForceSingleInstancePerCategory)
                    {
                        if (_sharedDict[category].Count > 0)
                        {
                            return(_sharedDict[category][0]);
                        }

//                        foreach (var i in _sharedDict[category])
//                        {
//                            return i;
//                        }
                    }

                    if (shareSetting == CraftingProgressShareSetting.Default)
                    {
                        foreach (var i in _sharedDict[category])
                        {
                            if (i.instanceID == instanceID)
                            {
                                return(i);
                            }
                        }
                    }
                }
            }
            else
            {
                return(_singleInstance);
            }

            return(Add(_createNewAction(validator, instanceID), category, shareSetting));
//            return Get(hash, category, shareSetting);
        }
 public bool IsShared(CraftingProgressShareSetting setting)
 {
     return(setting == CraftingProgressShareSetting.Default || setting == CraftingProgressShareSetting.ForceSingleInstancePerCategory);
 }