An electrochemical route towards the fabrication of nanostructured semiconductor solar cells