public function build(array $data)
    {
        $this->validateArrayKeys(
            array('id', 'create_time', 'state', 'intent', 'payer', 'transactions', 'links'),
            $data
        );


        if (empty($data['id'])) {
            throw new BuilderException('id is mandatory and should not be empty');
        }

        $links = array();
        foreach ($data['links'] as $link) {
            $links[] = $this->linkBuilder->build($link);
        }

        $payment = new Payment(
            $data['id'],
            $data['create_time'],
            $data['state'],
            $data['intent'],
            $this->payerBuilder->build($data['payer']),
            $this->transactionsBuilder->build($data['transactions']),
            $links,
            isset($data['update_time']) ? $data['update_time'] : null
        );
        $payment->setPaypalData($data);

        return $payment;
    }