public function get_attachments() {

        global $CFG;

        require_once($CFG->libdir.'/filelib.php');

        $syscontext = context_system::instance();

        $fs = get_file_storage();
        $files = $fs->get_area_files($syscontext->id, 'blog', 'attachment', $this->id);

        // Adding a blog_entry_attachment for each non-directory file.
        $attachments = array();
        foreach ($files as $file) {
            if ($file->is_directory()) {
                continue;
            }
            $attachments[] = new blog_entry_attachment($file, $this->id);
        }

        return $attachments;
    }