Allow multiple resources for the same JID in a MUC room

Implementation of esl/MongooseIM#240
Why do we need `lists:foldl` here, since `StateData` is not modified inside fun?