enterprise/a8n: Move code into helper function
Created by: ryanslade
This was meant to be included in https://github.com/sourcegraph/sourcegraph/pull/7453 but somehow got lost during merging
Created by: ryanslade
This was meant to be included in https://github.com/sourcegraph/sourcegraph/pull/7453 but somehow got lost during merging