Electrochemical synthesis of metal complexes in batch and flow