internal HashSet<Artifact> DeployArtefacts(IList<FileInfo> matchingArtifacts, string targetRepository, bool isFlatDeploy, string folderToDeploy, List<KeyValuePair<string, string>> propertiesList)
        {
            HashSet<Artifact> deployedArtifacts = new HashSet<Artifact>();
            foreach (var details in matchingArtifacts.ToDeployDetailsList(targetRepository))
            {

                details.properties = Build.buildMatrixParamsString(propertiesList);

                if (!isFlatDeploy)
                {
                    //when not set to flat deploy we preserve the folders hierarchy
                    details.artifactPath = string.Format(@"{0}\{1}", details.file.FullName.Replace(folderToDeploy, String.Empty).Replace(details.file.Name, String.Empty), details.artifactPath);
                }
                DeployArtefact(details);

                deployedArtifacts.Add(new Artifact
                {
                    type = details.file.Extension.Replace(".", String.Empty),
                    md5 = details.md5,
                    sha1 = details.sha1,
                    name = details.file.Name
                });

            }
            return deployedArtifacts;
        }