refactors invitation logic and membership logic into their own files. Add base classes for orgs membership