Abstracting out the validation process to its own js file to be reused. Validation and processing on save