Downlink and Uplink Energy Minimization Through User Association and Beamforming in C-RAN