RA-403 Added id check and removed unused emrsource