private static void TryUpdateCompany(Asset asset, ISnipeAccess access, Config config)
 {
     // Update the company if not known yet or changed using options.
     if ((asset.Company == null || asset.Company.Id != config.CompanyId) && config.CompanyId > 0)
     {
         asset.Company = access.Get <Company>(config.CompanyId);
     }
 }
 private static void TryUpdateLocation(Asset asset, ISnipeAccess access, Config config)
 {
     // Update the location if not known yet or changed.
     if ((asset.Location == null || asset.Location.Id != config.LocationId) && config.LocationId > 0)
     {
         asset.Location = access.Get <Location>(config.LocationId);
     }
 }
        /// <summary>
        /// Gets the db column names of the specified field names.
        /// </summary>
        /// <param name="access">SnipeAccess object.</param>
        /// <param name="fieldNames">Names of the fields.</param>
        private static Dictionary <string, string> GetCustomFieldNames(ISnipeAccess access, params string[] fieldNames)
        {
            var names          = new Dictionary <string, string>();
            var fieldNamesList = fieldNames.ToList();

            var fieldSets = access.Get <FieldSet>();

            foreach (var fieldSet in fieldSets)
            {
                foreach (var field in fieldSet.Fields.Rows)
                {
                    if (fieldNamesList.Contains(field.Name))
                    {
                        names.Add(field.Name, field.DbColumnName);
                    }
                }
            }

            return(names);
        }