To put in order / To sort out / To tidy up
Used both literally (tidying a physical space) and figuratively (sorting out a situation, thoughts, or affairs).
I need to put my ideas in order before writing.
He tidied up his office before the meeting.
—How is the situation? —We're sorting it out.