move common repository code to idb