/// <summary>
        /// Add entities from external typeSafeDictionary
        /// </summary>
        /// <param name="entitiesToSubmit"></param>
        /// <param name="groupId"></param>
        /// <exception cref="TypeSafeDictionaryException"></exception>
        public void AddEntitiesFromDictionary(ITypeSafeDictionary entitiesToSubmit, uint groupId)
        {
            var typeSafeDictionary = entitiesToSubmit as FastTypeSafeDictionary <TValue>;

            foreach (var tuple in typeSafeDictionary)
            {
                try
                {
                    if (_hasEgid)
                    {
                        SetEGIDWithoutBoxing <TValue> .SetIDWithoutBoxing(ref typeSafeDictionary.unsafeValues[tuple.Key],
                                                                          new EGID(tuple.Key, groupId));
                    }

                    _implementation.Add(tuple.Value);
                }
                catch (Exception e)
                {
                    throw new
                          TypeSafeDictionaryException("trying to add an EntityComponent with the same ID more than once Entity: ".
                                                      FastConcat(typeof(TValue).ToString()).FastConcat(", group ").
                                                      FastConcat(groupId).FastConcat(", id ").FastConcat(tuple.Key), e);
                }
            }
        }
        public void AddEntityToDictionary(EGID fromEntityGid, EGID toEntityID, ITypeSafeDictionary toGroup)
        {
            var valueIndex = _implementation.GetIndex(fromEntityGid.entityID);

            if (toGroup != null)
            {
                var     toGroupCasted = toGroup as ITypeSafeDictionary <TValue>;
                ref var entity        = ref _implementation.unsafeValues[(int)valueIndex];

                if (_hasEgid)
                {
                    SetEGIDWithoutBoxing <TValue> .SetIDWithoutBoxing(ref entity, toEntityID);
                }

                toGroupCasted.Add(fromEntityGid.entityID, entity);
            }