Nanostructured transition metal nitrides for energy storage and fuel cells