Methods for solving the matrix equation TB + CT = −A and its generalizations