refactor post invite method