@Override
  public RayoNode removeNode(String rayoNode) throws DatastoreException {

    log.debug("Removing node: [%s]", rayoNode);
    RayoNode node = getNode(rayoNode);
    if (node == null) {
      log.error("Node not found: [%s]", rayoNode);
      throw new RayoNodeNotFoundException();
    }
    RowDeletor deletor = Pelops.createRowDeletor(schemaName);
    deletor.deleteRow("ips", node.getIpAddress(), ConsistencyLevel.ONE);

    Mutator mutator = Pelops.createMutator(schemaName);
    for (String platform : node.getPlatforms()) {
      mutator.deleteColumn("nodes", platform, rayoNode);
    }

    try {
      mutator.execute(ConsistencyLevel.ONE);
      log.debug("Node [%s] deleted successfully", rayoNode);
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw new DatastoreException("Could not remove node");
    }

    return node;
  }
  @Override
  public final boolean deleteUserAccount(final UserAccount userAccount) {

    if (userAccount == null) {
      throw new IllegalArgumentException("The passed user account was null.");
    }

    final RowDeletor deletor = connectionPool.createRowDeletor();

    final String userid = userAccount.getId();
    final String username = userAccount.getUsername();

    deletor.deleteRow(COLUMN_FAMILY_USER, userid, CONSISTENCY_LEVEL_WRITE);
    deletor.deleteRow(COLUMN_FAMILY_USERNAME, username, CONSISTENCY_LEVEL_WRITE);

    return true;
  }
  private void removeAddresses(List<String> addresses) throws DatastoreException {

    log.debug("Removing addresses [%s]", addresses);
    RowDeletor deletor = Pelops.createRowDeletor(schemaName);
    for (String address : addresses) {
      deletor.deleteRow("addresses", address, ConsistencyLevel.ONE);
    }
  }
  @Override
  public void removeFilters(String id) throws DatastoreException {

    log.debug("Removing all filters for id [%s]", id);

    try {
      RowDeletor deletor = Pelops.createRowDeletor(schemaName);
      deletor.deleteRow("filters", id, ConsistencyLevel.ONE);
      log.debug("Filters removed successfully for id [%s]", id);
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw new DatastoreException("Could not remove filters");
    }
  }
  @Override
  public Application removeApplication(String jid) throws DatastoreException {

    log.debug("Removing application with id: [%s]", jid);
    Application application = getApplication(jid);
    if (application != null) {
      RowDeletor deletor = Pelops.createRowDeletor(schemaName);
      deletor.deleteRow("applications", jid, ConsistencyLevel.ONE);

      List<String> addresses = getAddressesForApplication(jid);
      removeAddresses(addresses);

    } else {
      log.debug("No application found with jid: [%s]", jid);
      throw new ApplicationNotFoundException();
    }
    return application;
  }
  @Override
  public GatewayMixer removeMixer(String name) throws DatastoreException {

    log.debug("Removing mixer with name: [%s]", name);
    GatewayMixer mixer = getMixer(name);

    Mutator mutator = Pelops.createMutator(schemaName);
    try {
      RowDeletor deletor = Pelops.createRowDeletor(schemaName);
      deletor.deleteRow("mixers", Bytes.fromUTF8(name), ConsistencyLevel.ONE);

      mutator.execute(ConsistencyLevel.ONE);
      log.debug("Mixer [%s] removed successfully", mixer);
    } catch (Exception e) {
      log.error(e.getMessage(), e);
      throw new DatastoreException("Could not remove mixer");
    }

    return mixer;
  }
  @Override
  public GatewayClient removeClient(String jid) throws DatastoreException {

    log.debug("Removing client with jid: [%s]", jid);
    GatewayClient client = getClient(jid);
    if (client != null) {
      Mutator mutator = Pelops.createMutator(schemaName);
      String bareJid = JIDUtils.getBareJid(jid);
      String resource = JIDUtils.getResource(jid);
      mutator.deleteColumn("clients", bareJid, resource);
      mutator.execute(ConsistencyLevel.ONE);

      List<String> resources = getClientResources(bareJid);
      if (resources.size() == 0) {
        RowDeletor deletor = Pelops.createRowDeletor(schemaName);
        deletor.deleteRow("clients", bareJid, ConsistencyLevel.ONE);
      }
      log.debug("Client with jid: [%s] removed successfully", jid);
    }

    return client;
  }
  @Override
  public GatewayCall removeCall(String id) throws DatastoreException {

    log.debug("Removing call with id: [%s]", id);
    GatewayCall call = getCall(id);

    if (call != null) {
      Mutator mutator = Pelops.createMutator(schemaName);
      mutator.deleteSubColumns("jids", "clients", call.getClientJid(), id);
      mutator.deleteSubColumns("jids", "nodes", call.getNodeJid(), id);

      try {
        RowDeletor deletor = Pelops.createRowDeletor(schemaName);
        deletor.deleteRow("calls", Bytes.fromUTF8(id), ConsistencyLevel.ONE);

        mutator.execute(ConsistencyLevel.ONE);
        log.debug("Call [%s] removed successfully", id);
      } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new DatastoreException("Could not remove call");
      }
    }
    return call;
  }