protected static function addFromArray(array $array, StatementOfAccount $statementOfAccount)
    {
        foreach ($array as $date => $statement) {
            if ($statementOfAccount->hasStatementForDate($date)) {
                $statementModel = $statementOfAccount->getStatementForDate($date);
            } else {
                $statementModel = new Statement();
                $statementModel->setDate(new \DateTime($date));
                $statementModel->setStartBalance((float) $statement['start_balance']['amount']);
                $statementModel->setCreditDebit($statement['start_balance']['credit_debit']);
                $statementOfAccount->addStatement($statementModel);
            }

            if (isset($statement['transactions'])) {
                foreach ($statement['transactions'] as $trx) {
                    $transaction = new Transaction();
                    $transaction->setBookingDate(new \DateTime($trx['booking_date']));
                    $transaction->setValutaDate(new \DateTime($trx['valuta_date']));
                    $transaction->setCreditDebit($trx['credit_debit']);
                    $transaction->setAmount($trx['amount']);
                    $transaction->setBookingText($trx['description']['booking_text']);
                    $transaction->setDescription1($trx['description']['description_1']);
                    $transaction->setDescription2($trx['description']['description_2']);
                    $transaction->setStructuredDescription($trx['description']['description']);
                    $transaction->setBankCode($trx['description']['bank_code']);
                    $transaction->setAccountNumber($trx['description']['account_number']);
                    $transaction->setName($trx['description']['name']);
                    $statementModel->addTransaction($transaction);
                }
            }
        }

        return $statementOfAccount;
    }