public function getSecondaryKeys($primaryKey = null)
    {
        if ($primaryKey) {
            if (!isset($this->values[$primaryKey])) {
                throw new OutOfBoundsException(sprintf(
                    'The key "%s" does not exist.',
                    $primaryKey
                ));
            }

            return array_keys($this->values[$primaryKey]);
        }

        $allSecondaryKeys = array();

        foreach ($this->values as $primaryKey => $valuesBySecondaryKey) {
            foreach ($valuesBySecondaryKey as $secondaryKey => $values) {
                $allSecondaryKeys[$secondaryKey] = true;
            }
        }

        return array_keys($allSecondaryKeys);
    }