Refactoring - repository only.
WIP. Not compileable.

PR request is clean from logic.