Added logic for Active activities, and for creating events only for active activities