Added check for existence of entity prior to adding URL