Validate input before trying to write to database