class CaseService extends RecordService {

    public Case update(ItemValuesMap itemValues, List<String> photoBitPaths) throws IOException {
        setCurrentDateIfRegistrationNotExist(itemValues);
        Gson gson = new Gson();
        Blob caseBlob = new Blob(gson.toJson(itemValues.getValues()).getBytes());
        Blob audioFileDefault = getAudioBlob();

        Case child = caseDao.getCaseByUniqueId(itemValues.getAsString(CASE_ID));
        child.setLastUpdatedDate(new Date(Calendar.getInstance().getTimeInMillis()));
        child.setContent(caseBlob);
        child.setName(getName(itemValues));
        String location = itemValues.has(LOCATION) ? itemValues.getAsString(LOCATION) : "";
        child.setLocation(location);
        int age = itemValues.getAsInt(AGE) != null ? itemValues.getAsInt(AGE) : EMPTY_AGE;
        child.setAge(age);
        child.setCaregiver(getCaregiverName(itemValues));
        child.setRegistrationDate(Utils.getRegisterDateByYyyyMmDd(itemValues.getAsString(REGISTRATION_DATE)));
        child.setAudio(audioFileDefault);
        child.setSynced(false);

        child = caseDao.update(child);

        updatePhoto(child, photoBitPaths);

        return child;
    }

    public  CaseService(CaseDao caseDao, CasePhotoDao casePhotoDao, IncidentDao incidentDao);

}