automatization of enrollment in groups.

Is there a way of automatizing the enrollment of students on a specific group within the course, by a professor clicking a button (in my case its assign from a reservation tool). And have the reverse option as well? By clicking again, unassign the student, and automatically remove the student from the group?

Thank you,