public string AddSource(string sourceId,
                                   string isCopyHeld,
                                   string isThackrayFound,
                                   string isViewed,
                                   string originalLocation,
                                   string sourceDesc,
                                   string sourceRef,
                                   string sourceNotes,
                                   string sourceDateStr,
                                   string sourceDateStrTo,
                                   string sourceFileCount,
                                   string parishs,
                                   string sourceTypes,
                                   string fileIds)
        {
            string retVal = "";

            var jss = new JavaScriptSerializer();

            var obj = jss.Deserialize<dynamic>(fileIds);

            var tp = new List<ServiceFile>();

            if (obj != null)
                foreach (dynamic item in obj)
                    tp.Add(new ServiceFile(item["url"],item["desc"],item["id"]));

            var ssobj = new SourceDto()
                {
                    IsCopyHeld = isCopyHeld.ToBool(),
                    IsThackrayFound = isThackrayFound.ToBool(),
                    IsViewed = isViewed.ToBool(),
                    OriginalLocation = originalLocation,
                    SourceDateStr = sourceDateStr,
                    SourceDateStrTo = sourceDateStrTo,
                    SourceDesc = sourceDesc,
                    SourceRef = sourceRef,
                    SourceNotes = sourceNotes,
                    SourceFileCount = sourceFileCount.ToInt32(),
                    SourceId = sourceId.ToGuid() ,
                    Files = tp,
                    Parishs = parishs.ParseToGuidList(),
                    SourceTypes = sourceTypes.ParseToIntList()
                };

            var iModel = new SourceSearch(new Security(new WebUser()));

            try
            {
                iModel.Update(ssobj, new SourceValidator(ssobj));

            }

            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            return WebHelper.MakeReturn(ssobj.SourceId.ToString(), retVal);
        }
        public IHttpActionResult AddSource(ServiceSourceAdd serviceSourceAdd)
        {
            string retVal = "";

            var jss = new JavaScriptSerializer();

            var obj = jss.Deserialize<dynamic>(serviceSourceAdd.FileIds?? "");

            var tp = new List<ServiceFile>();

            if (obj != null)
                foreach (dynamic item in obj)
                    tp.Add(new ServiceFile(item["url"], item["desc"], item["id"]));

            var ssobj = new SourceDto()
            {
                IsCopyHeld = serviceSourceAdd.IsCopyHeld.ToBool(),
                IsThackrayFound = serviceSourceAdd.IsThackrayFound.ToBool(),
                IsViewed = serviceSourceAdd.IsViewed.ToBool(),
                OriginalLocation = serviceSourceAdd.OriginalLocation,
                SourceDateStr = serviceSourceAdd.SourceDateStr,
                SourceDateStrTo = serviceSourceAdd.SourceDateStrTo,
                SourceDesc = serviceSourceAdd.SourceDesc,
                SourceRef = serviceSourceAdd.SourceRef,
                SourceNotes = serviceSourceAdd.SourceNotes,
                SourceFileCount = serviceSourceAdd.SourceFileCount.ToInt32(),
                SourceId = serviceSourceAdd.SourceId.ToGuid(),
                Files = tp,
                Parishs = serviceSourceAdd.Parishs.ParseToGuidList(),
                SourceTypes = serviceSourceAdd.SourceTypes.ParseToIntList()
            };

            var sourceSearch = new SourceSearch(new Security(new WebUser()));

            try
            {
                sourceSearch.Update(ssobj, new SourceValidator(ssobj));

            }

            catch (Exception ex1)
            {
                retVal = ex1.Message;
            }

            if (retVal != "")
            {
                return Content(HttpStatusCode.BadRequest, retVal);
            }

            return Ok(ssobj.SourceId.ToString());
        }