Pluck appointment ids in update_appointments

Issue: 
When creating an appointment in the calendar, we get a "You can't specify target table 'calendar_events' for update in FROM clause" mysql error. The update_appointments after_save hook generates subqueries in the update statement.

We pre-select the appointment_ids instead of generating a sql sub-query.