public void AddOrganism(Organism organism) { this.allOrganisms.Add(organism); var organismAsAnimal = organism as Animal; var organismAsPlant = organism as Plant; if (organismAsAnimal != null) this.animals.Add(organismAsAnimal); if (organismAsPlant != null) this.plants.Add(organismAsPlant); }