protected function onAfterWrite() {
        parent::onAfterWrite();
        
        $records=KapostConversionHistory::get()->filter('Created:LessThan', date('Y-m-d H:i:s', strtotime('-'.self::config()->expires_days.' days')));
        if($records->count()>0) {
            foreach($records as $record) {
                $record->delete();
            }
        }
    }