I have a node js app and one of the routes I keep getting "Can't set headers after they are sent error". 

**What the route does:**

Users in my app have certain access levels so this route goes through the users `accessLevel` array and finds the appropriate access level for this route. And based on the access level of the user who's calling the route has it performs different actions.

**The Code:**

```
app.post('/bios/approve', isLoggedIn, function(req, res) {

for (var i = 0; i < req.user.accessLevel.length; i++) {
    if (req.user.accessLevel[i] === "Bio Officer") {

        Bio.findOneAndUpdate({userID: req.body.userID, bioForSector: req.body.bioForSector}, {
            background: req.body.background,
            experience: req.body.experience,
            skills: req.body.skills,
            bioStatus: req.body.bioStatus
        }, function(err, editedBio) {

            if (err)
                console.log("Error while editing Pending Bio is " + err);

            else if (editedBio) {
                User.findOneAndUpdate({accessLevel: "Bio Designer"}, {
                    $push: {biosPending: editedBio._id}
                }, function(err, user) {

                    if (err) {
                        console.log("The error while finding lineManager is " + err);
                    } else if (user) {User.findOneAndUpdate({accessLevel: "Bio Officer"}, {
                            $pull: {
                                biosPending: editedBio._id
                            }
                        }, function(err, bioOfficer) {
                            if (err) {
                                console.log("The error while finding lineManager is " + err);
                            }
                            res.json("Bio Done!")
                        });

                    }
                });

            }

        });

    } else if (req.user.accessLevel[i] === "Bio Designer") {
        // Currently Empty

    } else {

        Bio.findOneAndUpdate({userID: req.body.userID,bioForSector: req.body.bioForSector}, {
            background: req.body.background,
            experience: req.body.experience,
            skills: req.body.skills,
            bioStatus: req.body.bioStatus
        }, function(err, editedBio) {

            if (err)
                console.log("Error while editing Pending Bio is " + err);

            else if (editedBio) {
                User.findOneAndUpdate({accessLevel: "Bio Officer"}, {$push: {biosPending: editedBio._id}
                }, function(err, user) {

                    if (err) {
                        console.log("The error while finding lineManager is " + err);
                    } else if (user) {

                        User.findOneAndUpdate({email: editedBio.lineManagerEmail}, {$pull: {biosPending: editedBio._id}
                        }, function(err, bioOfficer) {

                            if (err) {
                                console.log("The error while finding lineManager is " + err);
                            }
                            res.json("bio Done!")
                        });

                    }
                });

            }
        });
    }
}
});

```

**Any help will be greatly appreciated. Does anyone know what am I doing wrong?**