This code path can cause deadlocks when called on the main thread. Switch this to a background concurrent queue.