Move discard_offline_messages to sm_helper