public Response create(final TaskTO taskTO) {
TaskTO createdTask;
if (taskTO instanceof SyncTaskTO || taskTO instanceof SchedTaskTO) {
createdTask = taskController.createSchedTaskInternal((SchedTaskTO) taskTO);
} else {
throw new BadRequestException();
}
TaskType taskType = getTaskType(taskTO.getClass());
URI location = uriInfo.getAbsolutePathBuilder().path(taskType.toString() + "/" + createdTask.getId()).build();
return Response.created(location).header(SyncopeConstants.REST_HEADER_ID, createdTask.getId()).build();
}