protected function getGenericForeignKeys(array $foreignKeys)
    {
        $genericForeignKeys = array();

        foreach ($foreignKeys as $foreignKey) {
            $name = $foreignKey['name'];

            if (!isset($genericForeignKeys[$name])) {
                $genericForeignKeys[$name] = new ForeignKey(
                    $foreignKey['name'],
                    array($foreignKey['local_column_name']),
                    $foreignKey['foreign_table_name'],
                    array($foreignKey['foreign_column_name']),
                    $foreignKey['on_delete'],
                    $foreignKey['on_update']
                );
            } else {
                $genericForeignKeys[$name]->addLocalColumnName($foreignKey['local_column_name']);
                $genericForeignKeys[$name]->addForeignColumnName($foreignKey['foreign_column_name']);
            }
        }

        return array_values($genericForeignKeys);
    }