moved sqlite logic into data helper