Previous works (T. Speck, U. Seifert, J. Phys. A: Math. Gen. 38 (2005) L581-L588) suggest that the process of keeping a system (in contact with a thermal bath) in a out-of-equilibrium target state $\rho_s$ can be achieved by simply restoring the heat dissipated by the system in the thermal bath. Here we treat this problem form a fully quantum mechanical point of view. Using mathematical tools recently developed (D. Reeb, M. M. Wolf, arXiv: 1306:4352v2 (2014)), we prove that this is possible when the state $\rho_s$ commutes with the local Hamiltonian of the system $H_s.$ In this case, in order to keep the system in the state $\rho_s$ it is sufficient to compensate for the heat dumped in the bath by transferring the same amount of heat to the system from a second heat reservoir. We also express the amount of heat needed in terms of the state $\rho_s$ and the thermal equilibrium state $\rho_\beta$ only.