def METHOD_NAME(self, data, instance_id):
    if "password" in data:
        del data["password"]
    if "departments" in data:
        try:
            departments = []
            for department_id in data["departments"]:
                department = Department.get(department_id)
                if department is not None:
                    departments.append(department)
        except StatementError:
            raise DepartmentNotFoundException()
        data["departments"] = departments
    return data