public function debug()
    {
        $info = array();

        $metadata = $this->getMetadata();

        $referenceFields = array();
        foreach (array_merge($metadata['referencesOne'], $metadata['referencesMany']) as $name => $reference) {
            $referenceFields[] = $reference['field'];
        }

        // fields
        foreach ($metadata['fields'] as $name => $field) {
            if (in_array($name, $referenceFields)) {
                continue;
            }
            $info['fields'][$name] = $this->{'get'.ucfirst($name)}();
        }

        // referencesOne
        foreach ($metadata['referencesOne'] as $name => $referenceOne) {
            $info['referencesOne'][$name] = $this->{'get'.ucfirst($referenceOne['field'])}();
        }

        // referencesMany
        foreach ($metadata['referencesMany'] as $name => $referenceMany) {
            $info['referencesMany'][$name] = $this->{'get'.ucfirst($referenceMany['field'])}();
        }

        // embeddedsOne
        foreach ($metadata['embeddedsOne'] as $name => $embeddedOne) {
            $embedded = $this->{'get'.ucfirst($name)}();
            $info['embeddedsOne'][$name] = $embedded ? $embedded->debug() : null;
        }

        // embeddedsMany
        foreach ($metadata['embeddedsMany'] as $name => $embeddedMany) {
            $info['embeddedsMany'][$name] = array();
            foreach ($this->{'get'.ucfirst($name)}() as $key => $value) {
                $info['embeddedsMany'][$name][$key] = $value->debug();
            }
        }

        return $info;
    }