modify the condition of querying ToSend list
modify SqlHelper::count() method
extract method serializeRecords
adjust code structure