Extracted DB logic into Repository