Refactor invitation creation