Added checks to GroupManager to avoid duplicate entities in groups and leaking entity objects.

When adding an entity to a group we should check to see if it’s already
there.

When removing entities from a group and that group contains no more
entities then we should delete the entity/group pair from
groupsByEntity hash so that garbage collector can destroy.

Finally, removeFromAllGroups(e) was clearing the group within the
iteration of the group!? Got rid of it in favor of removing the entire
group from the groupsByEntity has once we’re done with that job.

This is untested as of pull request and submitted at very least as a
detailed notice of these flaws. Also there may be a better solution
than I’ve posted here and am very open to alternatives and feedback.

JunkDog will you please run a test? I’m not setup for testing at the
moment but want to learn how to be. Thanks ahead.