public function getMetadata($user, $imageIdentifier)
{
try {
$data = $this->getImageCollection()->findOne(['user' => $user, 'imageIdentifier' => $imageIdentifier]);
} catch (MongoException $e) {
throw new DatabaseException('Unable to fetch meta data', 500, $e);
}
if ($data === null) {
throw new DatabaseException('Image not found', 404);
}
return $this->bsonToArray->toArray($data['metadata']->getArrayCopy());
}