Moved data logic into repository