public static Expense ToModel(this IExpenseEntity entity) { var expense = new Expense { Id = new StorageKey(KeyGenerator.ExpenseEntitySuffix(entity.RowKey)).InvertedTicks, Approved = entity.Approved.HasValue ? entity.Approved.Value : false, CostCenter = entity.CostCenter, Date = entity.Date.HasValue ? entity.Date.Value : DateTime.UtcNow, ReimbursementMethod = (ReimbursementMethod)Enum.Parse(typeof(ReimbursementMethod), entity.ReimbursementMethod), Title = entity.Title, UserName = entity.PartitionKey.DecodePartitionAndRowKey(), ApproverName = entity.ApproverName }; return(expense); }