Corresponds to PUT request with a resource identifier, updating a single document in the database

async def update(self, **kwargs):
        '''
        Corresponds to PUT request with a resource identifier, updating a single document in the database
        '''
        try:
            self.data[self.pk] = self.pk_type(kwargs['pk'])
            updated_obj = await self._meta.object_class().update(self.db, data=self.data)
            if updated_obj is None:
                raise NotFound('Object matching the given {} was not found'.format(self.pk))
            return await updated_obj.serialize()
        except Exception as ex:
            logger.exception(ex)
            raise BadRequest(ex)