def put(self, username,account_id):
        data = request.get_json(force=True)
        account = AccountsModel.find_by_id(username, account_id)
        if account:  
            try:
                account.account_name = data['account_name']
                account.update_to_db()
            except:
                return {"message": "An error occurred updating the account."}, 500

        return account.json(), 201
    def delete(self, username, account_id):
        account = AccountsModel.find_by_id(username, account_id)
        if account:
            account.delete_from_db()

        return {'message': 'Acount deleted'}
 def get(self, username, account_id):
     account = AccountsModel.find_by_id(username, account_id)
     if account:
         return account.json()
     return {'message': 'account not found'}, 404