[BZ 1120418] schedule new job for failed step

This commit adds/fixes some logic for adding a new job to the queue for the
failed step. Any steps in the current job that are added or removed will be
persisted or deleted from the db respectively.

I also introduced logic to detect whether or not a job for the failed step is
already in the queue so that we do not keep adding duplicate jobs over and
over. This logic is not yet working as expected.