[TASK] Abstraction in repositories

Some functionality in repositories can be moved to an abstraction class

This patch moves this functionality