Port sort merge

CODE REVIEW

Made the sort and sym merge code generic and moved it to the open source repo.

@tannermiller-wf @alexandercampbell-wf @beaulyddon-wf @tylertreat-wf @stevenosborne-wf @ericolson-wf @rosshendrickson-wf