figure out one function for multiple fields by passing param using $data