<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _add_recent(self, doc, logged_id):
		"Keep a tab on the most recent message for each channel"
		spec = dict(channel=doc['channel'])
		doc['ref'] = logged_id
		doc.pop('_id')
		self._recent.replace_one(spec, doc, upsert=True)