Photonic crystal nanopattering of hybrid perovskite materials for photovoltaic solar cells and Light Emitting Diodes