public static function addRowToMap($row)
    {
        $id = static::getIdAttribute();
        if ($row !== null && isset($row[$id])) {
            self::$identityMap[$row[$id]] = $row instanceof ActiveRecord ? $row->toArray() : $row;
            $maxSize = static::getIdentityMapMaxSize();
            foreach (static::getUniqueAttributes() as $uniqueAttribute) {
                self::$uniqueAttributeToId[$uniqueAttribute][$row[$uniqueAttribute]] = $row[$id];
            }
            if ($maxSize !== -1 && count(self::$identityMap) > $maxSize) {
                array_shift(self::$identityMap);
            }
        }
    }