Flattening promise chain in crud file