Start of team functionality

This adds basic team creation functionality, the invitation system is almost finished. I have tested this code pretty thoroughly and I don't believe there are any breaking changes. Let me know if you get the chance to test it or if it looks good to merge then you can go ahead and do so.