public function toApiArray()
    {
        $entity = $this->toArray();
        foreach ($entity as $name => &$value) {
            if (null === $value) {
                unset($entity[$name]);
            } elseif ($value instanceof Entity) {
                $value = $value->toArray();
            }
        }
        return $entity;
    }