private static Artifact checkForExistingArtifact(
     final String filename, final boolean overrideExisting, final SoftwareModule softwareModule) {
   if (softwareModule.getArtifactByFilename(filename).isPresent()) {
     if (overrideExisting) {
       LOG.debug("overriding existing artifact with new filename {}", filename);
       return softwareModule.getArtifactByFilename(filename).get();
     } else {
       throw new EntityAlreadyExistsException(
           "File with that name already exists in the Software Module");
     }
   }
   return null;
 }