Add optimization to insert only most recent records