void Management::slaveSuccessDeleteABuild(int machineID, int buildID){
    Machine *machine = getMachineById(machineID);

    machine->deleteBuild(buildID);

    emit slaveDeletedBuild(machineID, buildID);
}
void Management::addBuildToSlave(int machineId, int BuildID, QString buildName){

    Machine *machine = getMachineById(machineId);

    if(machine == 0)
        return;

    Build *trueBuild = getBuildByID(BuildID);

    if(trueBuild == 0){
        //this point the build does not exist
        emit slaveGotBuild(machine, BuildID, buildName, false);
        //this point that machine has a build it is not suppose to have...go and delete it
        machine->deleteBuild(BuildID);

        //notify the slave that it should delete the build
        machine->deleteBuildNotify(BuildID);
    }
    else{
        Build *buildToAdd = new Build(BuildID, buildName, "", trueBuild->getBuildDirectory());

        bool existMachineWithBuild = machineWithBuild(machine->getMachineID(), buildToAdd->getBuildID());

        //if there already exist that build for the machine, don't add it twice
        if(existMachineWithBuild == false)
            machine->addBuild(buildToAdd);
        else
            return;

        emit slaveGotBuild(machine, BuildID, buildName, true);

        //check if the build name corrolate with the information on the
        //slave side
        if(buildName.compare(trueBuild->getBuildName())){
            machine->updateBuildName(buildToAdd->getBuildID(), trueBuild->getBuildName());
        }
    }

}