public void deleteFile(String filename) {
    EmployeeDetail detail = person.getEmployeeDetails();
    Set<String> files = new HashSet<>();
    files.addAll(detail.getFiles());
    files.remove(filename);

    EmployeeDetail newDetail = getEmployeeDetail(detail, files);
    EmployeeDetailFacade.getEmployeeDetailService().merge(newDetail);
    Person newPerson = getPerson(person, newDetail);
    PersonFacade.getPersonService().merge(newPerson);
  }
 private Set<String> updateEmpDetails(String fileId) {
   EmployeeDetail detail = person.getEmployeeDetails();
   Set<String> files = new HashSet<>();
   if (detail.getFiles() != null) {
     files = detail.getFiles();
   }
   files.add(fileId);
   EmployeeDetail newDetail = getEmployeeDetail(detail, files);
   EmployeeDetailFacade.getEmployeeDetailService().merge(newDetail);
   Person newPerson = getPerson(person, newDetail);
   PersonFacade.getPersonService().merge(newPerson);
   return newDetail.getFiles();
 }
  private OperatingCost getEntity(FieldGroup binder) {
    final OperatingCostBean operatingCostsBean =
        ((BeanItem<OperatingCostBean>) binder.getItemDataSource()).getBean();
    final Person driver =
        PersonFacade.getPersonService().findById(operatingCostsBean.getDriverId());

    final OperatingCost operatingCosts =
        new OperatingCost.Builder(new Date())
            .fuelCost(operatingCostsBean.getFuelCost())
            .fuelLitres(operatingCostsBean.getFuelLitres())
            .oilCost(operatingCostsBean.getOilCost())
            .oilLitres(operatingCostsBean.getOilLitres())
            .speedometer(operatingCostsBean.getSpeedometer())
            .slipNo(operatingCostsBean.getSlipNo())
            .driver(driver)
            .id(operatingCostsBean.getId())
            .build();

    return operatingCosts;
  }