Move logic of core data to the core data service