Corrected entity to id transformer so that it handles null values