Microsoft.Legal.MatterCenter.ValidationFunctions.ValidateContentType C# (CSharp) Method

ValidateContentType() private method

Validates content type for the matter.
private ValidateContentType ( Matter matter ) : GenericResponseVM
matter Microsoft.Legal.MatterCenter.Models.Matter Matter object containing Matter data
return Microsoft.Legal.MatterCenter.Models.GenericResponseVM
        private GenericResponseVM ValidateContentType(Matter matter)
        {
            if ((0 >= matter.ContentTypes.Count()) || string.IsNullOrWhiteSpace(matter.DefaultContentType))
            {                
                return GenericResponse(errorSettings.IncorrectInputContentTypeCode, errorSettings.IncorrectInputContentTypeMessage);
            }
            else
            {
                foreach (string contentType in matter.ContentTypes)
                {
                    var contentTypeCheck = Regex.Match(contentType, matterSettings.SpecialCharacterExpressionContentType, RegexOptions.IgnoreCase);
                    if (contentTypeCheck.Success || int.Parse(matterSettings.ContentTypeLength, CultureInfo.InvariantCulture) < contentType.Length)
                    {                        
                        return GenericResponse(errorSettings.IncorrectInputContentTypeCode, errorSettings.IncorrectInputContentTypeMessage);
                    }
                }
                var defaultContentTypeCheck = Regex.Match(matter.DefaultContentType, matterSettings.SpecialCharacterExpressionContentType, RegexOptions.IgnoreCase);
                if (defaultContentTypeCheck.Success || 
                    int.Parse(matterSettings.ContentTypeLength, CultureInfo.InvariantCulture) < matter.DefaultContentType.Length)
                {                    
                    return GenericResponse(errorSettings.IncorrectInputContentTypeCode, errorSettings.IncorrectInputContentTypeMessage);
                }
            }
            return null;
        }