private function validationRules($fields, $edit = false)
    {
        $validationRules = [];

        // Go through each field to find validation rules
        foreach ($fields as $name => $options) {
            if (isset($options['validate'])) {
                $validationRules[$name] = $options['validate'];

                // Change validation rules if there's validations as edit
                if ($edit && isset($options['validateAtEdit'])) {
                    $validationRules[$name] = $options['validateAtEdit'];
                }

                if ($options['type'] == 'image') {
                    $rules = explode('|', $validationRules[$name]);

                    // If there isn't a validation rule for the image, add it
                    if (!in_array('image', $rules)) {
                        $rules[] = 'image';
                    }

                    $validationRules[$name] = implode('|', $rules);
                }
            }
        }

        return $validationRules;
    }