Validation and save