Finish the syncDatabase method