add validation in duplication of codes