code: private function getAttributes(array $attributeData)
      {
          $attributes = [];
  
          foreach ($attributeData as $key => $value) {
              if (empty($value)) {
                  continue;
              }
  
              if ($value instanceof DateTimeInterface) {
                  $strValue = $value->format('Y-m-d H:i:s');
              } else {
                  $strValue = (string) $value;
              }
  
              $attribute = new Attribute();
              $attribute->setKey((string) $key);
              $attribute->setValue($strValue);
  
              $attributes[] = $attribute;
          }
  
          return $attributes;
      }
docs: @param array $attributeData
  
  @return Attribute[]