class CaseService extends RecordService {

    public Case save(ItemValuesMap itemValues, List<String> photoPaths) throws IOException {
        String uniqueId = generateUniqueId();
        String username = PrimeroAppConfiguration.getCurrentUser().getUsername();
        itemValues.addStringItem(CASE_DISPLAY_ID, getShortUUID(uniqueId));
        itemValues.addStringItem(CASE_ID, uniqueId);
        itemValues.addStringItem(RECORD_OWNED_BY, username);
        itemValues.addStringItem(RECORD_CREATED_BY, username);
        itemValues.addStringItem(PREVIOUS_OWNER, username);

        setCurrentDateIfRegistrationNotExist(itemValues);

        Gson gson = new Gson();
        Date date = new Date(System.currentTimeMillis());
        Blob blob = new Blob(gson.toJson(itemValues.getValues()).getBytes());
        Blob audioFileDefault = getAudioBlob();

        Case child = new Case();
        child.setUniqueId(uniqueId);
        child.setShortId(getShortUUID(uniqueId));
        child.setCreateDate(date);
        child.setLastUpdatedDate(date);
        child.setContent(blob);

        child.setName(getName(itemValues));

        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.setCreatedBy(username);
        child.setOwnedBy(username);
        String location = itemValues.has(LOCATION) ? itemValues.getAsString(LOCATION) : "";
        child.setLocation(location);
        child.setServerUrl(TextUtils.lintUrl(PrimeroAppConfiguration.getApiBaseUrl()));
        caseDao.save(child);
        savePhoto(child, photoPaths);
        return child;
    }

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

}