Refactor Live SQL into Model