createCards(trelloCards, boardId) {
    const result = [];
    trelloCards.forEach(card => {
      const cardToCreate = {
        archived: card.closed,
        boardId,
        // very old boards won't have a creation activity so no creation date
        createdAt: this._now(this.createdAt.cards[card.id]),
        dateLastActivity: this._now(),
        description: card.desc,
        listId: this.lists[card.idList],
        swimlaneId: this.swimlane,
        sort: card.pos,
        title: card.name,
        // we attribute the card to its creator if available
        userId: this._user(this.createdBy.cards[card.id]),
        dueAt: card.due ? this._now(card.due) : null,
      };
      // add labels
      if (card.idLabels) {
        cardToCreate.labelIds = card.idLabels.map(trelloId => {
          return this.labels[trelloId];
        });
      }
      // add members {
      if (card.idMembers) {
        const wekanMembers = [];
        // we can't just map, as some members may not have been mapped
        card.idMembers.forEach(trelloId => {
          if (this.members[trelloId]) {
            const wekanId = this.members[trelloId];
            // we may map multiple Trello members to the same wekan user
            // in which case we risk adding the same user multiple times
            if (!wekanMembers.find(wId => wId === wekanId)) {
              wekanMembers.push(wekanId);
            }
          }
          return true;
        });
        if (wekanMembers.length > 0) {
          cardToCreate.members = wekanMembers;
        }
      }
      // add vote
      if (card.idMembersVoted) {
        // Trello only know's positive votes
        const positiveVotes = [];
        card.idMembersVoted.forEach(trelloId => {
          if (this.members[trelloId]) {
            const wekanId = this.members[trelloId];
            // we may map multiple Trello members to the same wekan user
            // in which case we risk adding the same user multiple times
            if (!positiveVotes.find(wId => wId === wekanId)) {
              positiveVotes.push(wekanId);
            }
          }
          return true;
        });
        if (positiveVotes.length > 0) {
          cardToCreate.vote = {
            question: cardToCreate.title,
            public: true,
            positive: positiveVotes,
          };
        }
      }

      if (card.customFieldItems) {
        cardToCreate.customFields = [];
        card.customFieldItems.forEach(item => {
          const custom = {
            _id: this.customFields[item.idCustomField],
          };
          if (item.idValue) {
            custom.value = item.idValue;
          } else if (item.value.hasOwnProperty('checked')) {
            custom.value = item.value.checked === 'true';
          } else if (item.value.hasOwnProperty('text')) {
            custom.value = item.value.text;
          } else if (item.value.hasOwnProperty('date')) {
            custom.value = item.value.date;
          } else if (item.value.hasOwnProperty('number')) {
            custom.value = item.value.number;
          }
          cardToCreate.customFields.push(custom);
        });
      }

      // insert card
      const cardId = Cards.direct.insert(cardToCreate);
      // keep track of Trello id => Wekan id
      this.cards[card.id] = cardId;
      // log activity
      // Activities.direct.insert({
      //   activityType: 'importCard',
      //   boardId,
      //   cardId,
      //   createdAt: this._now(),
      //   listId: cardToCreate.listId,
      //   source: {
      //     id: card.id,
      //     system: 'Trello',
      //     url: card.url,
      //   },
      //   // we attribute the import to current user,
      //   // not the author of the original card
      //   userId: this._user(),
      // });
      // add comments
      const comments = this.comments[card.id];
      if (comments) {
        comments.forEach(comment => {
          const commentToCreate = {
            boardId,
            cardId,
            createdAt: this._now(comment.date),
            text: comment.data.text,
            // we attribute the comment to the original author, default to current user
            userId: this._user(comment.idMemberCreator),
          };
          // dateLastActivity will be set from activity insert, no need to
          // update it ourselves
          const commentId = CardComments.direct.insert(commentToCreate);
          // We need to keep adding comment activities this way with Trello
          // because it doesn't provide a comment ID
          Activities.direct.insert({
            activityType: 'addComment',
            boardId: commentToCreate.boardId,
            cardId: commentToCreate.cardId,
            commentId,
            createdAt: this._now(comment.date),
            // we attribute the addComment (not the import)
            // to the original author - it is needed by some UI elements.
            userId: commentToCreate.userId,
          });
        });
      }
      const attachments = this.attachments[card.id];
      const trelloCoverId = card.idAttachmentCover;
      if (attachments && Meteor.isServer) {
        attachments.forEach(att => {
          const self = this;
          const opts = {
            type: att.type ? att.type : undefined,
            userId: self._user(att.userId),
            meta: {
              boardId,
              cardId,
              source: 'import',
            },
          };
          const cb = (error, fileObj) => {
            if (error) {
              throw error;
            }
            self.attachmentIds[att._id] = fileObj._id;
            if (trelloCoverId === att._id) {
              Cards.direct.update(cardId, {
                $set: { coverId: fileObj._id },
              });
            }
          };
          if (att.url) {
            Attachments.load(att.url, opts, cb, true);
          } else if (att.file) {
            Attachments.insert(att.file, opts, cb, true);
          }
        });

        if (links) {
          if (links.length) {
            let desc = cardToCreate.description.trim();
            if (desc) {
              desc += '\n\n';
            }
            desc += `## ${TAPi18n.__('links-heading')}\n`;
            links.forEach(link => {
              desc += `* ${link}\n`;
            });
            Cards.direct.update(cardId, {
              $set: {
                description: desc,
              },
            });
          }
        }
      }
      result.push(cardId);
    });
    return result;
  }
Create the Wekan cards corresponding to the supplied Trello cards,
as well as all linked data: activities, comments, and attachments
@param trelloCards
@param boardId
@returns {Array}