public function setImages(array &$data, $file_model, $entity)
    {
        if (empty($data['images']) || empty($data[$entity . '_id'])) {
            return false;
        }

        foreach ($data['images'] as &$image) {
            if (empty($image['file_id'])) {
                $image['entity'] = $entity;
                $image['entity_id'] = $data[$entity . '_id'];
                $image['file_id'] = (int) $file_model->add($image);
            } else {
                $file_model->update($image['file_id'], $image);
            }
        }

        return true;
    }