public function prepareData($row)
    {
        if (!$row) {
            return $row;
        }

        if (!is_array($row)) {
            $row = $this->serializer->serialize($row, 'array', SerializationContext::create()->setSerializeNull(true));
        }

        foreach ($row as $key => $value) {
            if ($value instanceof \DateTime) {
                $row[$key] = $value->format(\DateTime::RFC3339);
            } elseif (is_bool($value)) {
                $row[$key] = true === $value ? 1 : 0;
            } elseif (is_array($value) || is_object($value)) {
                $row[$key] = json_encode($value);
            }
        }

        return $row;
    }