<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def recreate_article_body(self):
        '''
        Handles case where article body contained page or image.

        Assumes all articles and images have been created.
        '''
        for foreign_id, body in iteritems(self.record_keeper.article_bodies):
            try:
                local_page_id = self.record_keeper.get_local_page(foreign_id)
                page = Page.objects.get(id=local_page_id).specific

                # iterate through the body
                new_body = []
                for item in body:
                    if not item['value']:
                        continue
                    if item['type'] == 'page':
                        new_page_id = self.record_keeper.get_local_page(
                            item['value'])
                        item['value'] = new_page_id
                    elif item['type'] == 'image':
                        new_image_id = self.record_keeper.get_local_image(
                            item['value'])
                        item['value'] = new_image_id

                    new_body.append(item)

                setattr(page, 'body', json.dumps(new_body))
                page.save_revision().publish()

            except Exception as e:
                self.log(ERROR, "recreating article body",
                         {
                             "exception": e,
                             "foreign_id": foreign_id,
                             "body": body,
                         },
                         depth=1)