/**
  * @param \SimpleXMLElement $xml
  * @param User              $user
  *
  * @return Portfolio
  *
  * @throws \Exception
  */
 public function retrievePortfolioFromXml(\SimpleXMLElement $xml, User $user)
 {
     $portfolioTitleNodes = $xml->xpath('/feed/title');
     if (0 === count($portfolioTitleNodes)) {
         throw new \Exception("Missing portfolio's title");
     }
     $portfolio = new Portfolio();
     $portfolio->setTitle((string) $portfolioTitleNodes[0])->setUser($user)->setWidgets($this->retrieveWidgets($xml));
     return $portfolio;
 }