public function beforeSerialize(array $data)
    {
        foreach ($data as $idx => &$value) {
            if ($value instanceof \DateTime) {
                $value = $value->format('Y-m-d H:i:s');
            }
        }

        return $data;
    }