'Saves an itemrevision.  Create the item if it does not already exist.'

def store(self, ctype, region, account, name, active_flag, config, arn=None, new_issues=[], ephemeral=False):

    item = self._get_item(ctype, region, account, name)
    if arn:
        duplicate_arns = Item.query.filter((Item.arn == arn)).all()
        for duplicate_item in duplicate_arns:
            if (duplicate_item.id != item.id):
                duplicate_item.arn = None
                app.logger.info('Moving    ARN    {arn}    from    {duplicate}    to    {item}'.format(arn=arn, duplicate=duplicate_item.name, item=item.name))
                db.session.add(duplicate_item)
                db.session.commit()
    if arn:
        item.arn = arn
    item.latest_revision_complete_hash = self.hash_config(config)
    item.latest_revision_durable_hash = self.durable_hash(config, self.ephemeral_paths_for_tech(tech=ctype))
    if ephemeral:
        item_revision = item.revisions.first()
        item_revision.config = config
        item_revision.date_last_ephemeral_change = datetime.datetime.utcnow()
    else:
        item_revision = ItemRevision(active=active_flag, config=config)
        item.revisions.append(item_revision)
    for new_issue in new_issues:
        nk = '{}/{}'.format(new_issue.issue, new_issue.notes)
        if (nk not in ['{}/{}'.format(old_issue.issue, old_issue.notes) for old_issue in item.issues]):
            item.issues.append(new_issue)
            db.session.add(new_issue)
    for old_issue in item.issues:
        ok = '{}/{}'.format(old_issue.issue, old_issue.notes)
        if (ok not in ['{}/{}'.format(new_issue.issue, new_issue.notes) for new_issue in new_issues]):
            db.session.delete(old_issue)
    db.session.add(item)
    db.session.add(item_revision)
    db.session.commit()
    self._set_latest_revision(item)
    return item
