CMS-736 Introduce CRUD API for Relationship
First version of dao code + some other refactorings.