void ICandidateResumeFilesCommand.ValidateFile(string fileName, FileContents fileContents) { // Check the file extension. var extension = Path.GetExtension(fileName); if (string.IsNullOrEmpty(extension)) { throw new InvalidResumeExtensionException(extension); } if (!ValidExtensions.Contains(extension.TrimStart('.').ToLower())) { throw new InvalidResumeExtensionException(extension); } // Must not be too large. if (fileContents.Length > Constants.MaxResumeFileSize) { throw new FileTooLargeException { MaxFileSize = Constants.MaxResumeFileSize } } ; } void ICandidateResumeFilesCommand.CreateResumeFile(Guid candidateId, ResumeFileReference resumeFileReference) { resumeFileReference.Prepare(); resumeFileReference.Validate(); _repository.CreateResumeFile(candidateId, resumeFileReference); } void ICandidateResumeFilesCommand.UpdateLastUsedTime(ResumeFileReference resumeFileReference) { resumeFileReference.LastUsedTime = DateTime.Now; resumeFileReference.Validate(); _repository.UpdateResumeFile(resumeFileReference); } }