'Store the image data and return the new image id.
:raises: Duplicate if the image already exist.'

def create(self, context, metadata, data=None):

    image_id = str(metadata.get('id', uuidutils.generate_uuid()))
    metadata['id'] = image_id
    if (image_id in self.images):
        raise exception.CouldNotUploadImage(image_id=image_id)
    image_meta = copy.deepcopy(metadata)
    if ('size' not in image_meta):
        image_meta['size'] = None
    if ('status' not in metadata):
        image_meta['status'] = 'active'
    self.images[image_id] = image_meta
    if data:
        self._imagedata[image_id] = data.read()
    return self.images[image_id]
