'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', uuid.uuid4()))
    metadata['id'] = image_id
    if (image_id in self.images):
        raise exception.Duplicate()
    self.images[image_id] = copy.deepcopy(metadata)
    if data:
        self._imagedata[image_id] = data.read()
    return self.images[image_id]
