public void AddComponentToEntity(int entityId, GenericComponent componentToAdd) { if (!componentDictionary.ContainsKey(componentToAdd.GetType())) { componentDictionary.Add(componentToAdd.GetType(), new Dictionary <int, GenericComponent>()); } entityDictionary[entityId].Add(componentToAdd.GetType(), componentToAdd); componentDictionary[componentToAdd.GetType()].Add(entityId, componentToAdd); }