This seems weird/fragile to me, can we not just have a 'ready' event being fired from db?