Nanostructured metal-N-C electrocatalysts for CO2 reduction and hydrogen evolution reactions