Remove duplicate code for finding uniq array elements.

Change-Id: Ib574f903a52b27d0075029f2afb7845c58d61dba
fixes: CNVS-11932
Reviewed-on: https://gerrit.instructure.com/32153
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>