Validation into function to use it for edit customer too