Assignment assignment = assignmentDao.getAssignmentById(assignmentId);
if (assignment == null) {
throw new IllegalArgumentException(String.format(
"Could not find an assignment with id '%s'.", assignmentId));
}
AssignmentStatus status = assignment.getStatus();
if (status != AssignmentStatus.ACTIVE) {
throw new IllegalArgumentException(String.format(
"Could not add a video to a non ACTIVE assignment. "
+ "Current status of assignment id '%s' is '%s'.", assignmentId, status));
}