generic validate