@Test
public void shouldRemoveUnusedParametersBeforeSync() throws JSONException, IOException, GeneralSecurityException {

    RapidFtrApplication context = mockContext();
    String photoKeys = new JSONArray(Arrays.asList("photo-998877", "photo-998547", "1234ABC")).toString();
    String childDetails = String.format("{ 'name' : 'child1', 'test2' : 0, 'current_photo_key' : '1234ABC', 'recorded_audio' : '123455', 'audio_attachments' : {'original' : '123455', 'amr':'123455'}, 'photo_keys' : %s}", photoKeys);
    Child child = new Child("id", "user", childDetails);
    AudioCaptureHelper audioCaptureHelper = new AudioCaptureHelper(context);
    audioCaptureHelper.saveAudio(child, new ByteArrayInputStream("OK".getBytes()));
    byte[] content = "Testing".getBytes();
    PhotoCaptureHelper photoCaptureHelper = new PhotoCaptureHelper(context);
    photoCaptureHelper.savePhoto(BitmapFactory.decodeByteArray(content, 0, content.length), 10, "photo-998877");
    photoCaptureHelper.savePhoto(BitmapFactory.decodeByteArray(content, 0, content.length), 10, "photo-998547");
    photoCaptureHelper.savePhoto(BitmapFactory.decodeByteArray(content, 0, content.length), 10, "1234ABC");
    getFakeHttpLayer().addHttpResponseRule("http://whatever/api/children", "{}");
    genericSyncService.sync(child, "api/children");
    assertThat(child.optString("photo_keys"), is(""));
    assertThat(child.optString("audio_attachments"), is(""));
    assertThat(child.optString("synced"), is(""));
}