docs: def RemoveAndAddFeatures(self, url, pathToFeatureClass, id_field, chunksize=1000):
          """Deletes all features in a feature service and uploads features from a feature class on disk.
  
          Args:
              url (str): The URL of the feature service.
              pathToFeatureClass (str): The path of the feature class on disk.
              id_field (str): The name of the field in the feature class to use for chunking.
              chunksize (int): The maximum amount of features to upload at a time. Defaults to 1000.
          Raises:
              ArcRestHelperError: if ``arcpy`` can't be found.
  
          """
          fl = None
  
          try:
              if arcpyFound == False:
                  raise common.ArcRestHelperError({
                      "function": "RemoveAndAddFeatures",
                      "line": inspect.currentframe().f_back.f_lineno,
                      "filename":  'featureservicetools',
                      "synerror": "ArcPy required for this function"
                  })
              arcpy.env.overwriteOutput = True
              tempaddlayer= 'ewtdwedfew'
              if not arcpy.Exists(pathToFeatureClass):
                  raise common.ArcRestHelperError({
                      "function": "RemoveAndAddFeatures",
                      "line": inspect.currentframe().f_back.f_lineno,
                      "filename":  'featureservicetools',
                      "synerror": "%s does not exist" % pathToFeatureClass
                       }
                      )
  
              fields = arcpy.ListFields(pathToFeatureClass,wild_card=id_field)
              if len(fields) == 0:
                  raise common.ArcRestHelperError({
                      "function": "RemoveAndAddFeatures",
                      "line": inspect.currentframe().f_back.f_lineno,
                      "filename":  'featureservicetools',
                      "synerror": "%s field does not exist" % id_field
                  })
              strFld = True
              if fields[0].type != 'String':
                  strFld = False
  
              fl = FeatureLayer(
                      url=url,
                      securityHandler=self._securityHandler)
  
              id_field_local = arcpy.AddFieldDelimiters(pathToFeatureClass, id_field)
              idlist = []
              print( arcpy.GetCount_management(in_rows=pathToFeatureClass).getOutput(0) + " features in the layer")
              with arcpy.da.SearchCursor(pathToFeatureClass, (id_field)) as cursor:
                  allidlist = []
  
                  for row in cursor:
                      if (strFld):
                          idlist.append("'" + row[0] +"'")
                      else:
                          idlist.append(row[0])
                      if len(idlist) >= chunksize:
                          allidlist.append(idlist)
                          idlist = []
  
                  if len(idlist) > 0:
                      allidlist.append(idlist)
                  for idlist in allidlist:
                      idstring = ' in (' + ','.join(map(str,idlist)) + ')'
                      sql = id_field + idstring
                      sqlLocalFC = id_field_local + idstring
                      results = fl.deleteFeatures(where=sql,
                                                  rollbackOnFailure=True)
  
                      if 'error' in results:
                          raise common.ArcRestHelperError({
                              "function": "RemoveAndAddFeatures",
                              "line": inspect.currentframe().f_back.f_lineno,
                              "filename":  'featureservicetools',
                              "synerror":results['error']
                          })
                      elif 'deleteResults' in results:
                          print ("%s features deleted" % len(results['deleteResults']))
                          for itm in results['deleteResults']:
                              if itm['success'] != True:
                                  print (itm)
                      else:
                          print (results)
  
                      arcpy.MakeFeatureLayer_management(pathToFeatureClass,tempaddlayer,sqlLocalFC)
                      results = fl.addFeatures(fc=tempaddlayer)
  
                      if 'error' in results:
                          raise common.ArcRestHelperError({
                              "function": "RemoveAndAddFeatures",
                              "line": inspect.currentframe().f_back.f_lineno,
                              "filename":  'featureservicetools',
                              "synerror":results['error']
                          })
                      elif 'addResults' in results:
                          print ("%s features added" % len(results['addResults']))
                          for itm in results['addResults']:
                              if itm['success'] != True:
                                  print (itm)
                      else:
                          print (results)
                      idlist = []
              if 'error' in results:
                  raise common.ArcRestHelperError({
                      "function": "RemoveAndAddFeatures",
                      "line": inspect.currentframe().f_back.f_lineno,
                      "filename":  'featureservicetools',
                      "synerror":results['error']
                  })
              else:
                  print (results)
          except arcpy.ExecuteError:
              line, filename, synerror = trace()
              raise common.ArcRestHelperError({
                  "function": "create_report_layers_using_config",
                  "line": line,
                  "filename":  filename,
                  "synerror": synerror,
                  "arcpyError": arcpy.GetMessages(2),
              }
                             )
          except:
              line, filename, synerror = trace()
              raise common.ArcRestHelperError({
                          "function": "AddFeaturesToFeatureLayer",
                          "line": line,
                          "filename":  filename,
                          "synerror": synerror,
                                          }
                                          )
          finally:
              gc.collect()