I have Liferay 6.2 GA4...
I want to create a birthdays calendar by code, in a portlet... so I create a calendar in my portlet, with this code:

```
long calendarId = CounterLocalServiceUtil.increment(Calendar.class.getName());
calendar =  CalendarLocalServiceUtil.createCalendar(calendarId);
calendar.setName(BIRTHDAYS_CALENDAR_NAME);
calendar.setGroupId(themeDisplay.getScopeGroupId());
calendar.setUserId(themeDisplay.getUserId());
calendar.setCreateDate(new Date());
calendar.setCompanyId(themeDisplay.getCompanyId());
calendar.setUserName(themeDisplay.getUser().getFullName());
calendar.setModifiedDate(new Date());
calendar.setCalendarResourceId(getCalendarDefault(themeDisplay.getScopeGroupId()).getCalendarResourceId());
calendar.setColor(6663561);
CalendarLocalServiceUtil.addCalendar(calendar);

```

**this works fine**, and the calendar gets created... but after that i am facing an issue...

If I try to set permissions to the calendar in the portlet (in the site), i get a blank page with an error in the log:

```
java.lang.IllegalArgumentException: Permissioned model is null

```

so my question is:
how can i create the calendar with permissions? 
i want to create it with the default permissions, when you create a calendar in the site, this is what is shown, they are:

**Permissions**

**Viewable by: Site Members**

how can i do this??

thank you!!

**edit**

I asked this same question in the liferay forums, and didnt get an answer there... so im asking here, hopefully ill get an answer here :)

[same question](https://www.liferay.com/es/community/forums/-/message_boards/message/62911480)