Added logging
Saving and loading of foreign key relations