Unique reference number generation