 # @option query [object] event
 # @option query [function] onSuccess
 # @option query [function] onError
-handleEvent = (query) ->
+# @private
+_handleEvent = (query) ->
 	id = (muRegex.exec query.url)[1]
-	getEvents
+	_getEvents
 		ids: [id]
 		onError: (error) ->
 			query.onError
 				error: error
 				module: 'meetup'
 		onSuccess: (muEvents) ->
-			event = parseEvent muEvents[0]
+			event = _parseEvent muEvents[0]
 			db.set
 				events: [event]
+				onSuccess: query.onSuccess
+				onError: query.onError
+
+
+# Handle Meetup group events
+# @param [object] query
+# @option query [object] event
+# @option query [function] onSuccess
+# @option query [function] onError
+# @private
+_handleGroupEvents = (query) ->
+	_getEvents
+		name: query.name
+		onError: (error) ->
+			query.onError
+				error: error
+				module: 'meetup'
+		onSuccess: (muEvents) ->
+			events = []
+			for event in muEvents
+				events.push _parseEvent event
+			db.set
+				events: events
 				onSuccess: query.onSuccess
 				onError: query.onError
 

# @param [string] id
# @param [function] onError
# @param [function] onSuccess
getEvents = (eventQuery) ->
	mu.getEvents
		event_id: eventQuery.ids
		(error, events) ->
			if error
				eventQuery.onError error
			else
				eventQuery.onSuccess events.results


# Get Meetup group by group 'urlname'

# @option query [object] event
# @option query [function] onSuccess
# @option query [function] onError
_handleGroup = (query) ->
	name = (muGroupRegex.exec query.url)[1]
	_getGroups
		names: [name]
		onError: (error) ->
			query.onError
				error: error
				module: 'meetup'
		onSuccess: (muGroup) ->
			group = _parseGroup muGroup
			query.name = group.raw.urlname
			db.setGroup
				group: group
				onSuccess: () -> _handleGroupEvents query
				onError: query.onError


# Import and url
# @param [object] query
