/// <summary>
 /// Convert Organisation Entity  into Organisation Object
 /// </summary>
 ///<param name="model">OrganisationViewModel</param>
 ///<param name="OrganisationEntity">DataAccess.Organisation</param>
 ///<returns>OrganisationViewModel</returns>
 public static OrganisationViewModel ToViewModel(
     this DataAccess.Organisation entity,
     OrganisationViewModel model)
 {
     model.Id                 = entity.Id;
     model.Name               = entity.Name;
     model.ProvinceId         = entity.ProvinceId;
     model.CountryId          = entity.Province.CountryId;
     model.Abbreviation       = entity.Abbreviation;
     model.OrganisationTypeId = entity.OrganisationTypeId;
     model.Province           = entity.Province.Name;
     model.Country            = entity.Province.Country.Name;
     model.OrganisationType   = entity.OrganisationType.Name;
     model.IsActive           = entity.IsActive;
     return(model);
 }
        /// <summary>
        /// Convert Organisation Object into Organisation Entity
        /// </summary>
        ///<param name="model">Organisation</param>
        ///<param name="OrganisationEntity">DataAccess.Organisation</param>
        ///<returns>DataAccess.Organisation</returns>
        public static DataAccess.Organisation ToEntity(this OrganisationViewModel model,
                                                       DataAccess.Organisation entity)
        {
            if (entity.Id == 0)
            {
                entity.CreatedUserId = model.SessionUserId;
                entity.IsActive      = model.IsActive;
            }
            else
            {
                entity.UpdatedUserId    = model.SessionUserId;
                entity.UpdatedTimestamp = DateTime.Now;
            }
            entity.Name               = model.Name;
            entity.Abbreviation       = model.Abbreviation;
            entity.ProvinceId         = model.ProvinceId;
            entity.OrganisationTypeId = model.OrganisationTypeId;

            return(entity);
        }