catch the null entityId case before go to try catch