/// <summary>
 /// Check the data in current object
 /// </summary>
 /// <param name='webSpeciesObservationFieldDescription'>The Species Observation Field Description.</param>
 public static void CheckData(this WebSpeciesObservationFieldDescription webSpeciesObservationFieldDescription)
 {
     if (!webSpeciesObservationFieldDescription.IsDataChecked)
     {
         webSpeciesObservationFieldDescription.CheckStrings();
         webSpeciesObservationFieldDescription.IsDataChecked = true;
     }
 }
        /// <summary>
        /// (cached) Return a list of fieldDescription and mapping
        /// Get all Species observation field descriptions from the DB.
        /// </summary>
        /// <param name="context">Web service request context.</param>
        /// <param name="reloadCache">Optional, if set to true the cache will be reset.</param>
        /// <returns>A List with all public Species observation field Descriptions.</returns>
        public List <WebSpeciesObservationFieldDescription> GetSpeciesObservationFieldDescriptions(WebServiceContext context, Boolean reloadCache = false)
        {
            var cacheKey = this.GetCacheKey(Settings.Default.DarwinCoreFieldDescriptionCacheKey, context);

            if (reloadCache)
            {
                this.ClearCache(cacheKey, context);
            }

            var darwinCoreFieldDescriptions = (List <WebSpeciesObservationFieldDescription>)(context.GetCachedObject(cacheKey));

            if (darwinCoreFieldDescriptions.IsEmpty() || reloadCache)
            {
                List <WebSpeciesObservationFieldDescriptionExtended> darwinCoreFieldDescriptionsExtended = GetSpeciesObservationFieldDescriptionsExtended(context, false);
                darwinCoreFieldDescriptions = new List <WebSpeciesObservationFieldDescription>();

                foreach (WebSpeciesObservationFieldDescriptionExtended webSpeciesObservationFieldDescriptionExtended in darwinCoreFieldDescriptionsExtended)
                {
                    if (webSpeciesObservationFieldDescriptionExtended.IsPublic)
                    {
                        var speciesObservationFieldDescription = new WebSpeciesObservationFieldDescription();

                        speciesObservationFieldDescription.Class            = webSpeciesObservationFieldDescriptionExtended.Class;
                        speciesObservationFieldDescription.Definition       = webSpeciesObservationFieldDescriptionExtended.Definition;
                        speciesObservationFieldDescription.DefinitionUrl    = webSpeciesObservationFieldDescriptionExtended.DefinitionUrl;
                        speciesObservationFieldDescription.Documentation    = webSpeciesObservationFieldDescriptionExtended.Documentation;
                        speciesObservationFieldDescription.DocumentationUrl = webSpeciesObservationFieldDescriptionExtended.DocumentationUrl;
                        speciesObservationFieldDescription.Guid             = webSpeciesObservationFieldDescriptionExtended.Guid;
                        speciesObservationFieldDescription.Id               = webSpeciesObservationFieldDescriptionExtended.Id;
                        speciesObservationFieldDescription.Importance       = webSpeciesObservationFieldDescriptionExtended.Importance;
                        speciesObservationFieldDescription.IsAcceptedByTdwg = webSpeciesObservationFieldDescriptionExtended.IsAcceptedByTdwg; //added
                        speciesObservationFieldDescription.IsClass          = webSpeciesObservationFieldDescriptionExtended.IsClass;
                        //speciesObservationFieldDescription.IsDarwinCoreProperty = webSpeciesObservationFieldDescriptionExtended.IsDarwinCoreProperty
                        speciesObservationFieldDescription.IsImplemented           = webSpeciesObservationFieldDescriptionExtended.IsImplemented; //added
                        speciesObservationFieldDescription.IsMandatory             = webSpeciesObservationFieldDescriptionExtended.IsMandatory;
                        speciesObservationFieldDescription.IsMandatoryFromProvider = webSpeciesObservationFieldDescriptionExtended.IsMandatoryFromProvider;
                        speciesObservationFieldDescription.IsObtainedFromProvider  = webSpeciesObservationFieldDescriptionExtended.IsObtainedFromProvider;
                        speciesObservationFieldDescription.IsPlanned = webSpeciesObservationFieldDescriptionExtended.IsPlanned;
                        //speciesObservationFieldDescription.IsPublic = webSpeciesObservationFieldDescriptionExtended.IsPublic; //added
                        speciesObservationFieldDescription.IsSearchable = webSpeciesObservationFieldDescriptionExtended.IsSearchable;
                        speciesObservationFieldDescription.IsSortable   = webSpeciesObservationFieldDescriptionExtended.IsSortable;
                        speciesObservationFieldDescription.Label        = webSpeciesObservationFieldDescriptionExtended.Label;
                        speciesObservationFieldDescription.Mappings     = webSpeciesObservationFieldDescriptionExtended.Mappings;
                        speciesObservationFieldDescription.Name         = webSpeciesObservationFieldDescriptionExtended.Name;
                        speciesObservationFieldDescription.Property     = webSpeciesObservationFieldDescriptionExtended.Property;
                        speciesObservationFieldDescription.Remarks      = webSpeciesObservationFieldDescriptionExtended.Remarks;
                        speciesObservationFieldDescription.SortOrder    = webSpeciesObservationFieldDescriptionExtended.SortOrder;
                        speciesObservationFieldDescription.Type         = webSpeciesObservationFieldDescriptionExtended.Type;
                        speciesObservationFieldDescription.Uuid         = webSpeciesObservationFieldDescriptionExtended.Uuid;

                        darwinCoreFieldDescriptions.Add(speciesObservationFieldDescription);
                    }
                }

                // Add information to cache.
                context.AddCachedObject(cacheKey,
                                        darwinCoreFieldDescriptions,
                                        DateTime.Now + new TimeSpan(1, 0, 0, 0),
                                        CacheItemPriority.High);
            }
            return(darwinCoreFieldDescriptions);
        }