public static ChatroomInfo GetChatroomInfo(User fromUser, Chatroom chatroom) { IMapper mapper; if (chatroom.Contains(fromUser)) { mapper = ChatroomInfoMapper.MemberMapper; } else { mapper = ChatroomInfoMapper.NonMemberMapper; } return(mapper.Map <Chatroom, ChatroomInfo>(chatroom)); }