Repository fix for checking existing Entities in DB