refactor invitation controller