repository: fixed identity map saving

I don't understand how can I missed that. Sorry.
relationships: fixed removing entity with compulsary foreign key