Dye-sensitized photoelectrochemical and solid-state solar cells: charge separation, transport and recombination mechanisms