Simplified maintenance_record_count by using a "counter_cache"