protected function cleanProperties($attributes = [], $validKeys = []) { $array = []; foreach ($attributes as $attribute => $value) { if (in_array($attribute, $validKeys)) { $array[$attribute] = $value; } } return $array; }