public static BaseFile CreateSubmissionContentFile(int submissionId, int assignmentId, HttpPostedFileBase httpPostedFileBase) { return(httpPostedFileBase.ContentLength > 0 ? new File() { AssignmentId = assignmentId, SubmissionId = submissionId, Content = httpPostedFileBase.Bytes(), Extension = httpPostedFileBase.FileExtension(), FileName = httpPostedFileBase.FileNameFromPath(), ContentType = httpPostedFileBase.ContentType, ContentLength = httpPostedFileBase.ContentLength } : null); }