this kind of validation shall put in a seperate logic. and it shall be generic. Rewrite it so that i can take care any type of data.