Added protection against saving an entity, which does not have a reposit...

...ory