public function hydrate(array $data, $object)
    {
        foreach ($data as $name => $value) {
            if (!isset($this->profileClassMap[$name])) {
                continue;
            }
            
            if (empty($value)) {
                // We need to check, if collection has a profile and
                // remove it.
                foreach ($object as $p) {
                    if ($p instanceof $this->profileClassMap[$name]) {
                        $object->removeElement($p);
                        continue 2;
                    }
                }
                // No profile found, so do nothing.
                continue;
            }
            
            if (is_string($value)) {
                $value = \Zend\Json\Json::decode($value, \Zend\Json\Json::TYPE_ARRAY);
            }

            /* If there is already a profile of this type, we do not need to
             * add it, but update the data only.
             */
            foreach ($object as $p) {
                if ($p instanceof $this->profileClassMap[$name]) {
                    // Already a profile in the collection, just update and continue main loop.
                    $p->setData($value);
                    continue 2;
                }
            }
                
            // We need to add a new profile to the collection.
            $class = $this->profileClassMap[$name];
            $profile = new $class();
            $profile->setData($value);
            $object->add($profile);
        }
        return $object;
    }