protected function getJsonView($data, \Request $request)
 {
     $vars = $request->getRequestVars();
     $command = '';
     if (!empty($data['command'])) {
         $command = $data['command'];
     }
     $system_details = '';
     switch ($command) {
         case 'editPermissions':
             $result = SettingsFactory::userPermissionsList($data, $request);
             break;
         case 'editDepartments':
             $result = SettingsFactory::departmentsList($data, $request);
             break;
         case 'editLocations':
             $result = SettingsFactory::locationsList($data, $request);
             break;
         case 'getDepartments':
             $result = SettingsFactory::getDepartmentByID($vars['department_id']);
             break;
         case 'getLocation':
             $result = SettingsFactory::getLocationByID($vars['location_id']);
             break;
         default:
             throw new Exception("Invalid command received in system controller getJsonView. Command = {$command}");
     }
     $view = new \View\JsonView($result);
     return $view;
 }