db functions for joining and leaving events