private function save(ProductFileGroup $fileGroup) { $validator = $this->buildValidator(); if ($validator->isValid()) { foreach ($this->application->getLanguageArray(true) as $lang) { if ($this->request->isValueSet('name_' . $lang)) { $fileGroup->setValueByLang('name', $lang, $this->request->get('name_' . $lang)); } } $fileGroup->save(); return new JSONResponse(array('status' => "success", 'ID' => $fileGroup->getID())); } else { return new JSONResponse(array('status' => "failure", 'errors' => $validator->getErrorList())); } }