Yes, you can always do that.
It has nothing to do with being alive, them/their is just the pronoun for any plural noun, whether the singular was he, she or it.
Unlike the singular "it" which always implies a non-person, the plural pronouns "they", "them", and "those" do not. The plural forms should be used for any plural noun, whether or not it is a person. There aren't actually plural forms of people-specific pronouns.
For a single apple, you put it into a container. For multiple apples, you put them into a container and for multiple people, you still put them into a container.