check if IDM record exists first