Implemented saving of relations using safePersist

This is only hotfix version which can be improved to be more clear by code. However it works now.

Fixes #78