Refactor guid exists check