public function deserialize($data, ResourceRights $resourceRights = null)
    {
        if (empty($resourceRights)) {
            $resourceRights = new ResourceRights();
        }
        if (isset($data['mask'])) {
            $resourceRights->setMask($data['mask']);
        }
        if (isset($data['resource'])) {
            $resource = $this->resourceRepo->findOneBy(['uuid' => $data['resource']['id']]);
            $resourceRights->setResource($resource);
        }
        if (isset($data['role'])) {
            $role = $this->roleRepo->findOneBy(['uuid' => $data['role']['id']]);
            $resourceRights->setRole($role);
        }

        return $resourceRights;
    }