async def update(self, user: UD) -> UD:
    user_dict = user.dict()
    user_dict.pop('id')
    oauth_accounts = user_dict.pop('oauth_accounts', None)
    model = (await self.model.get(id=user.id))
    for field in user_dict:
        setattr(model, field, user_dict[field])
    (await model.save())
    if (oauth_accounts and self.oauth_account_model):
        (await model.oauth_accounts.all().delete())
        oauth_account_objects = []
        for oauth_account in oauth_accounts:
            oauth_account_objects.append(self.oauth_account_model(user=model, **oauth_account))
        (await self.oauth_account_model.bulk_create(oauth_account_objects))
    return user
async def update(self, user: UD) -> UD:
    user_dict = user.dict()
    user_dict.pop('id')
    oauth_accounts = user_dict.pop('oauth_accounts', None)
    model = (await self.model.get(id=user.id))
    for field in user_dict:
        setattr(model, field, user_dict[field])
    (await model.save())
    if (oauth_accounts and self.oauth_account_model):
        (await model.oauth_accounts.all().delete())
        oauth_account_objects = []
        for oauth_account in oauth_accounts:
            oauth_account_objects.append(self.oauth_account_model(user=model, **oauth_account))
        (await self.oauth_account_model.bulk_create(oauth_account_objects))
    return user