Pull out the sequence number selection and handle this up front. Also, the
correct record is already known, so avoid reassignment.