protected function createProfileFromData($token, $data, $parent = null) {
$profile = new Profile($token);
$profile
->setIp($data['ip']);
$profile
->setMethod($data['method']);
$profile
->setUrl($data['url']);
$profile
->setTime($data['time']);
$profile
->setCollectors(unserialize(base64_decode($data['data'])));
if (!$parent && !empty($data['parent'])) {
$parent = $this
->read($data['parent']);
}
if ($parent) {
$profile
->setParent($parent);
}
$profile
->setChildren($this
->readChildren($token, $profile));
return $profile;
}