Initially i thought that this function was generic enough to just match key and throw that variable into the check function, but turns out that's not the case.
I suggest renaming it to SyncUntilArray, and adding a generic function SyncUntil which does above expected behaviour.