protected function processRoles(Group $group, $roles)
    {
        /** @var RestHelperInterface $restHelper */
        $restHelper = $this->get('sulu_core.doctrine_rest_helper');

        $get = function($entity) {
            /* @var RoleInterface $entity */
            return $entity->getId();
        };

        $delete = function($role) {
            $this->getDoctrine()->getManager()->remove($role);
        };

        $update = function($role, $roleData) {
            return $this->updateRole($role, $roleData);
        };

        $add = function($role) use ($group) {
            return $this->addRole($group, $role);
        };

        return $restHelper->processSubEntities($group->getRoles(), $roles, $get, $add, $update, $delete);
    }